package com.cz.nongyetongv5.activity;

import android.app.AlertDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.text.Editable;
import android.text.InputFilter;
import android.text.InputType;
import android.text.SpannableStringBuilder;
import android.text.TextWatcher;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;

import com.cz.nongyetongv5.R;
import com.cz.nongyetongv5.adapter.WheelViewAdapter;
import com.cz.nongyetongv5.adapter.config.CommonConstants;
import com.cz.nongyetongv5.adapter.dao.DatabaseHelper;
import com.cz.nongyetongv5.application.InitApplication;
import com.cz.nongyetongv5.bean.BeiJianDanWei;
import com.cz.nongyetongv5.bean.ChanPinJianCeRecord;
import com.cz.nongyetongv5.bean.ChanPinLeiBie;
import com.cz.nongyetongv5.bean.ChouYanJiGou;
import com.cz.nongyetongv5.bean.Dict;
import com.cz.nongyetongv5.bean.Duixiangleixing;
import com.cz.nongyetongv5.bean.Huanjie;
import com.cz.nongyetongv5.bean.JianCeFangFa;
import com.cz.nongyetongv5.bean.JianCeLeiBie;
import com.cz.nongyetongv5.bean.JianCeYiJu;
import com.cz.nongyetongv5.bean.JianChaHangYe;
import com.cz.nongyetongv5.bean.JianChaRenYuan;
import com.cz.nongyetongv5.bean.Kv;
import com.cz.nongyetongv5.bean.Photo;
import com.cz.nongyetongv5.bean.Plan;
import com.cz.nongyetongv5.bean.RenWuLaiYuan;
import com.cz.nongyetongv5.bean.TextInfo;
import com.cz.nongyetongv5.bean.Town;
import com.cz.nongyetongv5.bean.User;
import com.cz.nongyetongv5.bean.YangPin;
import com.cz.nongyetongv5.custom.dialog.CustomDialog;
import com.cz.nongyetongv5.custom.wheelview.TosAdapterView;
import com.cz.nongyetongv5.custom.wheelview.TosAdapterView.OnItemSelectedListener;
import com.cz.nongyetongv5.custom.wheelview.Utils;
import com.cz.nongyetongv5.custom.wheelview.WheelView;
import com.cz.nongyetongv5.utils.CharsetUtil;
import com.cz.nongyetongv5.utils.ConfigUtil;
import com.cz.nongyetongv5.utils.DialogUtil;
import com.cz.nongyetongv5.utils.ImageUtil;
import com.cz.nongyetongv5.utils.SerliazableUtil;
import com.cz.nongyetongv5_1.adapter.ListAdapter;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.IOException;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.UUID;

public class ChanPinJianCePlanRecordActivity extends Fragment implements
		OnClickListener {
	public static String pid=null;
	private ViewGroup rl_chanpinjiance_item_suoshuquyu = null;

	/**
	 * ≥È—˘ª˙ππ
	 */
	private ViewGroup rl_chanpinjiance_item_chouyangjigou = null;

	/**
	 * —˘∆∑–≈œ¢
	 */
	private ViewGroup rl_chanpinjiance_item_yangpinxinxi = null;

	/**
	 *  ‹ºÏµ•Œª
	 */
	private ViewGroup rl_chanpinjiance_item_shoujiandanwei = null;

	/**
	 * ≥È—˘»À‘±
	 */
	private ViewGroup rl_chanpinjiance_item_chouyangrenyuan = null;

	/**
	 * »ŒŒÒ¿¥‘¥
	 */
	private ViewGroup rl_chanpinjiance_item_renwulaiyuan = null;

	/**
	 * ºÏ—È¿‡±
	 */
	private ViewGroup rl_chanpinjiance_item_jianyanleibie = null;

	/**
	 * ≤˙∆∑¿‡±
	 */
	private ViewGroup rl_chanpinjiance_item_chanpinleibie = null;




	/**
	 * Õ®—∂µÿ÷∑
	 */
	private ViewGroup rlChouYangDanWeiAdress = null;

	/**
	 * ∏∫‘»À
	 */
	private ViewGroup rlChouYangDanWeiFuZeRen = null;

	/**
	 * ¡™œµ∑Ω Ω
	 */
	private ViewGroup rlChouYangDanWeiLianXiFangShi = null;

	/**
	 *  ‹ºÏµ•Œªµƒ≤ºæ÷
	 */
	private ViewGroup llCreateShouJianDanWeiLayout = null;

	/**
	 * ≥È—˘≈ƒ’’
	 */
	private ViewGroup rl_chanpinjiance_item_chouyangpaizhao = null;

	/**
	 * «©√˚
	 */
	private ViewGroup rl_chanpinjiance_item_qianming = null;

	/**
	 *  ˝æ›ø‚∞Ô÷˙∂‘œÛ
	 */
	private DatabaseHelper db = null;

	/**
	 *  ˝æ›∂‘œÛ
	 */
	private DataBean dataBean = new DataBean();

	/**
	 * ”√ªß∂‘œÛ
	 */
	private User user = null;

	/**
	 * »∑»œ∂‘œÛ
	 */
	private SureExecuter sureExecuter = new SureExecuter();

	private boolean isEditMode = false;

	/**
	 * »•ListView Check Manager “≥√Ê
	 */
	public static final int TO_LISTVIEWCHECKMANAGER_REQUEST_CODE = 1;

	/**
	 * »•—˘∆∑–≈œ¢µƒ“≥√Ê
	 */
	public static final int TO_YANGPINXINXI_REQUEST_CODE = 2;

	/**
	 * »•≥È—˘≈ƒ’’
	 */
	public static final int TO_CHOUYANGPAIZHAO = 3;
	/**
	 * »•≥È—˘≈ƒ’’
	 */
	public static final int TO_SELENTS = 66;


	// »•«©√˚
	public static final int TO_QIANMING = 4;

	private ConfigUtil configUtil = null;


	/**
	 * ≥ı ºªØ ”Õº
	 */
	private void initView() {


		rl_jianchehuanjie= (ViewGroup) getActivity().findViewById(R.id.rl_jianchehuanjie);
		rl_jianchehuanjie.setOnClickListener(this);
		// ≤È—Ø≥ˆºÏ≤È––“µ
		rl_jiandujiancha_item_jianchahangye = (ViewGroup) getActivity()
				.findViewById(R.id.rl_jiandujiancha_item_jianhangye);
		rl_jiandujiancha_item_jianchahangye.setOnClickListener(this);
		rl_jiandujiancha_item_duixiangleixing= (ViewGroup) getActivity().findViewById(R.id.rl_jiandujiancha_item_duixiangleixing);
		rl_jiandujiancha_item_duixiangleixing.setOnClickListener(this);
		rl_chanpinjiance_item_yangpinxinxi = (ViewGroup) getActivity()
				.findViewById(R.id.rl_chanpinjiance_item_yangpinxinxi);
		rl_chanpinjiance_item_yangpinxinxi.setOnClickListener(this);

		rl_chanpinjiance_item_suoshuquyu = (ViewGroup) getActivity()
				.findViewById(R.id.rl_chanpinjiance_item_suoshuquyu);
		rl_chanpinjiance_item_suoshuquyu.setOnClickListener(this);

		rl_chanpinjiance_item_chouyangjigou = (ViewGroup) getActivity()
				.findViewById(R.id.rl_chanpinjiance_item_chouyanjigou);
		rl_chanpinjiance_item_chouyangjigou.setOnClickListener(this);

		rl_chanpinjiance_item_chouyangrenyuan = (ViewGroup) getActivity()
				.findViewById(R.id.rl_chanpinjiance_item_chouyangrenyuan);
		rl_chanpinjiance_item_chouyangrenyuan.setOnClickListener(this);

		rl_chanpinjiance_item_shoujiandanwei = (ViewGroup) getActivity()
				.findViewById(R.id.rl_chanpinjiance_item_shoujiandanwei);
		rl_chanpinjiance_item_shoujiandanwei.setOnClickListener(this);

		// ¥¥Ω® ‹ºÏµ•Œªµƒ≤ºæ÷
		rlChouYangDanWeiAdress = (ViewGroup) getActivity().findViewById(
				R.id.rlChouYangDanWeiAdress);
		rlChouYangDanWeiAdress.setOnClickListener(this);

		llCreateShouJianDanWeiLayout = (ViewGroup) getActivity().findViewById(
				R.id.llCreateShouJianDanWeiLayout);
		llCreateShouJianDanWeiLayout.setOnClickListener(this);

		rlChouYangDanWeiFuZeRen = (ViewGroup) getActivity().findViewById(
				R.id.rlChouYangDanWeiFuZeRen);
		rlChouYangDanWeiFuZeRen.setOnClickListener(this);

		rlChouYangDanWeiLianXiFangShi = (ViewGroup) getActivity().findViewById(
				R.id.rlChouYangDanWeiLianXiFangShi);
		rlChouYangDanWeiLianXiFangShi.setOnClickListener(this);

		rl_chanpinjiance_item_renwulaiyuan = (ViewGroup) getActivity()
				.findViewById(R.id.rl_chanpinjiance_item_renwulaiyuan);
		rl_chanpinjiance_item_renwulaiyuan.setOnClickListener(this);

		rl_chanpinjiance_item_jianyanleibie = (ViewGroup) getActivity()
				.findViewById(R.id.rl_chanpinjiance_item_jianyanleibie);
		rl_chanpinjiance_item_jianyanleibie.setOnClickListener(this);

		rl_chanpinjiance_item_chanpinleibie = (ViewGroup) getActivity()
				.findViewById(R.id.rl_chanpinjiance_item_chanpinleibie);
		rl_chanpinjiance_item_chanpinleibie.setOnClickListener(this);



		rl_chanpinjiance_item_chouyangpaizhao = (ViewGroup) getActivity()
				.findViewById(R.id.rl_chanpinjiance_item_chouyangpaizhao);
		rl_chanpinjiance_item_chouyangpaizhao.setOnClickListener(this);

		rl_chanpinjiance_item_qianming = (ViewGroup) getActivity()
				.findViewById(R.id.rl_chanpinjiance_item_qianming);
		rl_chanpinjiance_item_qianming.setOnClickListener(this);
	}

	/**
	 * ≥ı ºªØ≈‰÷√
	 */
	private void initConfig() {
		db = new DatabaseHelper(getActivity(), CommonConstants.DBNAME, null,
				CommonConstants.DATABASE_VERSION);

		user = (User) getActivity().getIntent().getSerializableExtra("user");

		List<ChanPinJianCeRecord> records = SerliazableUtil
				.getChanPinJianCeRecordByState(0, this.user.getUsername());

		if (records.size() > 0 && dataBean.data == null) {
			dataBean.data = records.get(0);
		}

		if (dataBean.data == null) {

			dataBean.data = new ChanPinJianCeRecord();

			dataBean.data.setUsername(this.user.getUsername());

		}

		if (dataBean.data != null
				&& !CharsetUtil.isNotNull(dataBean.data.getId())) {

			String id = UUID.randomUUID().toString().replaceAll("-", "");

			dataBean.data.setId(id);

		}

		/*
		 * ∏˘æ›”√ªß–≈œ¢Ω¯––«¯”Úµƒ≥ı ºªØ
		 */

		if (user.getCityId() != null) {
			dataBean.getData().getTowns()[0] = db.queryTownById(user
					.getCityId());
		}

		if (user.getArea() != null) {
			dataBean.getData().getTowns()[1] = db.queryTownById(user.getArea());

		}

		if (user.getTownId() != null) {
			dataBean.getData().getTowns()[2] = db.queryTownById(user
					.getTownId());

		}
		if (user.getStreetId() != null) {
			dataBean.getData().getTowns()[3] = db.queryTownById(user
					.getStreetId());

		}
		if (!dataBean.checkChouYanJiGou()) {
			/*
			 * ∏˘æ›”√ªß–≈œ¢≥ı ºªØª˙ππ
			 */

			List<ChouYanJiGou> jianChaDanWeis = db
					.queryAllChouYanJiGouNotLike(user.getKnowRegion() + "");

			if (jianChaDanWeis.size() == 1) {
				// ≥ı ºªØ ˝æ›
				dataBean.data.setChouYanJiGou(jianChaDanWeis.get(0));
			}

		}

		if (!dataBean.checkChouYangRenYuan()) {

			/*
			 * ∏˘æ›”√ªß–≈œ¢≥ı ºªØ≥È—˘»À‘±µƒ–≈œ¢
			 */
			List<JianChaRenYuan> renYuans = db.queryAllJianChaRenYuanNotLikeByRank(
					user.getKnowRegion() + "", user.getShowname(),"3");

			if (renYuans.size() > 0) {

				// …Ë÷√≤ª‘ –Ì…æ≥˝
				renYuans.get(0).setAllowRemove(false);

				if (!dataBean.data.getChouYangRenYuans().contains(
						renYuans.get(0))) {

					dataBean.data.getChouYangRenYuans().add(renYuans.get(0));
				}

			}

		}


		/**
		 * ◊‘∂ØÃÓ–¥«¯”Ú
		 */
		sureExecuter.sureQuYu();
		sureExecuter.sureJianChaHangYe();
		sureExecuter.sureDuxiangleixing();
		sureExecuter.surePlan();
		sureExecuter.sureChouYangJieGuo();
		sureExecuter.sureChouYangRenYuan();
		sureExecuter.sureShouJianDanWei();
		sureExecuter.sureTongXunDiZhi();
		sureExecuter.sureFuZeRen();
		sureExecuter.sureLianXiFangShi();
		sureExecuter.sureYangPinXinXi();
		sureExecuter.sureRenWuLaiYuan();
		sureExecuter.sureJianCeLeiBie();
		sureExecuter.sureChanPinLeiBie();
		sureExecuter.sureQianMing();
		/***plan_do*/
		// ≤È—Ø≥ˆÀ˘”–ºÏ≤È––“µ

		sureExecuter.sureHuanjie();
		sureExecuter.surePlan();
		if(ChouyangrenwuActivity.getCheckPlan()!=null){
			checkPlan(ChouyangrenwuActivity.getCheckPlan());
			if(dataBean.checkPlan()){
				List<Huanjie> huanjies =Huanjie.getLists(dataBean.getPlan().getAllowSection());

				if(huanjies.size()==1){
					dataBean.data.setHuanjie(huanjies.get(0));
				}
			}
			sureExecuter.sureHuanjie();

			pid=null;
		}else{


		}


		sureExecuter.surePaiZhao();
		sureExecuter.sureQianMing();

	}

	private void checkPlan(JSONObject data){
		Plan plan = new Plan();
		plan.setId(data.optString("id"));
		plan.setEntArea(data.optString("area"));
		plan.setEntAreaName(data.optString("area_name"));
		plan.setAllowSection(data.optString("section"));



		dataBean.data.setPlan(plan);
		dataBean.data.setChanPinLeiBie(null);
		dataBean.getData().setDuixiangleixing(new ArrayList<Duixiangleixing>());
		sureExecuter.sureDuxiangleixing();
		sureExecuter.sureChanPinLeiBie();
		// clearBeijingdanwei();

		sureExecuter.surePlan();


		String plancode=plan.getEntArea();

		if(plancode.length()>3&&plancode.substring(0, 4).equals("3204")){
			dataBean.getData().setTowns(new Town[4]);
			if(plancode.length()>3){
				Town town1=db.queryTownById(plancode.substring(0, 4));
				if(town1!=null)dataBean.getData().getTowns()[0]=town1;
			}
			if(plancode.length()>5){
				Town town1=db.queryTownById(plancode.substring(0, 6));
				if(town1!=null)dataBean.getData().getTowns()[1]=town1;
			}
			if(plancode.length()>7){
				Town town1=db.queryTownById(plancode.substring(0,8));
				if(town1!=null)dataBean.getData().getTowns()[2]=town1;
			}
			if(plancode.length()>9){
				Town town1=db.queryTownById(plancode.substring(0,10));
				if(town1!=null)dataBean.getData().getTowns()[3]=town1;
			}
		}else{
			dataBean.getData().getTowns()[0]=new Town(plancode,plan.getEntAreaName());
		}
		String[] k11=dataBean.data.getPlan().arrayEntKinds();
		if(k11!=null&&k11.length==1){
			if(!k11[0].equals("[]")){
				List<Kv> k12 =Dict.getKinds(k11);
				if(k12!=null&&k12.size()>0){
					Duixiangleixing temp=new Duixiangleixing(k12.get(0).getId(),k12.get(0).getName());
					dataBean.getData().setDuixiangleixing(new ArrayList<Duixiangleixing>());
					dataBean.getData().getDuixiangleixing().add(temp);
					sureExecuter.sureDuxiangleixing();
				}
			}
		}

		String[] ps=dataBean.getPlan().arrayEntProduces();
		if(ps!=null&&ps.length==1){

			if(!ps[0].equals("[]")){
				List<ChanPinLeiBie> jianYanLeiBies1 = db.queryAllChanPinLeiBie();
				for(int i=0;i<jianYanLeiBies1.size();i++){
					if(ps[0].equals(jianYanLeiBies1.get(i).getId().toString())){
						dataBean.data.setChanPinLeiBie(jianYanLeiBies1.get(i));
					}
				}
				sureExecuter.sureChanPinLeiBie();
			}
		}




		String[] ps1=dataBean.getPlan().arrayEntTrade();
		if(ps1!=null&&ps1.length==1){

			if(!ps1[0].equals("[]")){
				dataBean.data.getJianChaHangYes().clear();
				List<JianChaHangYe> hys = db.queryAllJianChaHangYe();
				for(int i=0;i<hys.size();i++){
					if(ps1[0].equals(hys.get(i).getId().toString())){
						dataBean.data.getJianChaHangYes().add(hys.get(i));
					}
				}
				sureExecuter.sureJianChaHangYe();
			}
		}

		sureExecuter.sureQuYu();
		SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

	}
	private void checkPlan_v160916(String id){
		Plan plan = db
				.queryPlanByID(id);
		if (plan!=null){
			dataBean.data.setPlan(plan);
			dataBean.data.setChanPinLeiBie(null);
			dataBean.getData().setDuixiangleixing(new ArrayList<Duixiangleixing>());
			sureExecuter.sureDuxiangleixing();
			sureExecuter.sureChanPinLeiBie();
			clearBeijingdanwei();

			sureExecuter.surePlan();


			String plancode=plan.getEntArea();

			Log.d("rafe_dr",plancode);

			dataBean.getData().setTowns(new Town[4]);
			if(plancode.length()>3){
				Town town1=db.queryTownById(plancode.substring(0, 4));
				if(town1!=null)dataBean.getData().getTowns()[0]=town1;
			}
			if(plancode.length()>5){
				Town town1=db.queryTownById(plancode.substring(0, 6));
				if(town1!=null)dataBean.getData().getTowns()[1]=town1;
			}
			if(plancode.length()>7){
				Town town1=db.queryTownById(plancode.substring(0,8));
				if(town1!=null)dataBean.getData().getTowns()[2]=town1;
			}
			if(plancode.length()>9){
				Town town1=db.queryTownById(plancode.substring(0,10));
				if(town1!=null)dataBean.getData().getTowns()[3]=town1;
			}

			String[] k11=dataBean.data.getPlan().arrayEntKinds();
			if(k11!=null&&k11.length==1){
				if(!k11[0].equals("[]")){
					List<Kv> k12 =Dict.getKinds(k11);
					if(k12!=null&&k12.size()>0){
						Duixiangleixing temp=new Duixiangleixing(k12.get(0).getId(),k12.get(0).getName());
						dataBean.getData().setDuixiangleixing(new ArrayList<Duixiangleixing>());
						dataBean.getData().getDuixiangleixing().add(temp);
						sureExecuter.sureDuxiangleixing();
					}
				}
			}

			String[] ps=dataBean.getPlan().arrayEntProduces();
			if(ps.length==1){

				if(!ps[0].equals("[]")){
					List<ChanPinLeiBie> jianYanLeiBies1 = db.queryAllChanPinLeiBie();
					for(int i=0;i<jianYanLeiBies1.size();i++){
						if(ps[0].equals(jianYanLeiBies1.get(i).getId().toString())){
							dataBean.data.setChanPinLeiBie(jianYanLeiBies1.get(i));
						}
					}
					sureExecuter.sureChanPinLeiBie();
				}
			}




			String[] ps1=dataBean.getPlan().arrayEntTrade();
			if(ps1.length==1){

				if(!ps1[0].equals("[]")){
					dataBean.data.getJianChaHangYes().clear();
					List<JianChaHangYe> hys = db.queryAllJianChaHangYe();
					for(int i=0;i<hys.size();i++){
						if(ps1[0].equals(hys.get(i).getId().toString())){
							dataBean.data.getJianChaHangYes().add(hys.get(i));
						}
					}
					sureExecuter.sureJianChaHangYe();
				}
			}

			sureExecuter.sureQuYu();
			SerliazableUtil.saveTemp(dataBean.data, user.getUsername());
		}
	}
	/**
	 *
	 */
	public ViewGroup rl_jianchehuanjie = null;
	/**
	 * ∂‘œÛ¿‡–Õ
	 */
	protected ViewGroup rl_jiandujiancha_item_duixiangleixing = null;
	/**
	 * ºÏ≤È––“µ
	 */
	private ViewGroup rl_jiandujiancha_item_jianchahangye = null;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
							 Bundle savedInstanceState) {
		return inflater.inflate(R.layout.v1_4_chanpinchouyangform, container,
				false);

	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);

		configUtil = new ConfigUtil(getResources());

		initView();

		initConfig();

	}

	@Override
	public void onClick(View v) {

		final AlertDialog bottomWindow = new AlertDialog.Builder(
				new ContextThemeWrapper(getActivity(),
						R.style.NongYeTongFullscreenTheme)).create();

		//  ‰»Î∑®µƒ…Ë÷√
		bottomWindow.getWindow().setFlags(
				WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
				WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

		// …Ë÷√¥∞ø⁄µƒ∂Øª≠
		bottomWindow.getWindow().setWindowAnimations(R.style.bottomAnimStyle);
		//∂‘œÛ¿‡–Õ
		if(v==rl_jiandujiancha_item_duixiangleixing){
			onClickDuixiangleixing(bottomWindow );
		}

		// µ±µ„ª˜ºÏ≤È––“µµƒ ±∫Ú
		if (v == rl_jiandujiancha_item_jianchahangye) {

			// ≤È—Ø≥ˆÀ˘”–ºÏ≤È––“µ
			String[] ps=null;
			if(dataBean.checkPlan())
				ps=dataBean.getPlan().arrayEntTrade();

			bottomWindow.show();

			/**
			 * ºÏ≤È––“µµ◊≤øµƒ≤ºæ÷
			 */
			ViewGroup bottomJianChaHangYeWindowLayout = (ViewGroup) getActivity()
					.getLayoutInflater().inflate(
							R.layout.bottom_jianchahangye, null);

			// »√µ◊≤øµƒøÌ∂»∫Õ∆¡ƒªµƒøÌ∂»“ª÷¬
			bottomJianChaHangYeWindowLayout.setMinimumWidth(getActivity()
					.getWindowManager().getDefaultDisplay().getWidth());

			// …Ë÷√µ◊≤ø≤ºæ÷
			bottomWindow.setContentView(bottomJianChaHangYeWindowLayout);

			// µØ≥ˆ ‰»Î∑®µƒ≤Ÿ◊˜
			bottomWindow.getWindow().clearFlags(
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

			bottomWindow.getWindow().setGravity(Gravity.BOTTOM);

			/**
			 * Ω¯–– ”Õºµƒ∂ØÃ¨…˙≥…
			 */
			ViewGroup jianChaHangYeLayout = (ViewGroup) bottomJianChaHangYeWindowLayout
					.findViewById(R.id.jianchayangyelayout);
			// «Â¿Ì ”Õº
			jianChaHangYeLayout.removeAllViews();

			// ≤È—Ø≥ˆÀ˘”–ºÏ≤È––“µ
			List<JianChaHangYe> jianChaHangYes =new ArrayList<JianChaHangYe>();
			List<JianChaHangYe> jianChaHangYes1 = db.queryAllJianChaHangYe();
			if(ps!=null){
				for(int i=0;i<jianChaHangYes1.size();i++){
					if(Arrays.binarySearch(ps, jianChaHangYes1.get(i).getId().toString())>=0){
						jianChaHangYes.add(jianChaHangYes1.get(i));
					}
				}
			}else{
				jianChaHangYes=jianChaHangYes1;

			}


			final List<CheckBox> cbsJianChaHangYe = new ArrayList<CheckBox>();

			// ±È¿˙ºÏ≤È––“µΩ¯–– ”Õºµƒ…˙≥…
			for (final JianChaHangYe temp : jianChaHangYes) {

				final RelativeLayout rootLayout = new RelativeLayout(
						getActivity());

				MarginLayoutParams rootLayoutPrams = new MarginLayoutParams(
						MarginLayoutParams.MATCH_PARENT,
						MarginLayoutParams.WRAP_CONTENT);

				rootLayoutPrams.setMargins(0,
						Utils.dip2px(getActivity(), 3), 0,
						Utils.dip2px(getActivity(), 3));

				// ºÊ»›µÕ∞Ê±æ…Ë÷√margin∑Ω∑®
				LayoutParams layoutPrarams = new LayoutParams(
						rootLayoutPrams);
				layoutPrarams.gravity = Gravity.TOP | Gravity.LEFT;

				rootLayout.setLayoutParams(layoutPrarams);
				rootLayout.setClickable(true);
				rootLayout.setGravity(Gravity.CENTER_VERTICAL);
				rootLayout.setPadding(Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 5),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 5));
				rootLayout
						.setBackgroundResource(R.drawable.jiandujiancha_item_style);

				/*********************************************/
				TextView tvBeiJianChaHangYe = new TextView(getActivity());

				RelativeLayout.LayoutParams tvBeiJianChaHangYeLayout = new RelativeLayout.LayoutParams(
						RelativeLayout.LayoutParams.WRAP_CONTENT,
						RelativeLayout.LayoutParams.WRAP_CONTENT);
				tvBeiJianChaHangYeLayout
						.addRule(RelativeLayout.CENTER_VERTICAL);
				tvBeiJianChaHangYe
						.setLayoutParams(tvBeiJianChaHangYeLayout);

				tvBeiJianChaHangYe.setPadding(
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8));
				tvBeiJianChaHangYe
						.setTextColor(Color.parseColor("#656769"));
				tvBeiJianChaHangYe.setTextSize(20);
				tvBeiJianChaHangYe.setText(temp.getName());

				rootLayout.addView(tvBeiJianChaHangYe);

				/*********************************************/

				CheckBox cbBeiJianChaHangYe = new CheckBox(getActivity());

				cbBeiJianChaHangYe.setTag(temp);

				RelativeLayout.LayoutParams cbBeiJianChaHangYeLayout = new RelativeLayout.LayoutParams(
						RelativeLayout.LayoutParams.WRAP_CONTENT,
						RelativeLayout.LayoutParams.WRAP_CONTENT);
				cbBeiJianChaHangYeLayout
						.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
				cbBeiJianChaHangYeLayout
						.addRule(RelativeLayout.CENTER_VERTICAL);
				cbBeiJianChaHangYe
						.setLayoutParams(cbBeiJianChaHangYeLayout);

				if (dataBean.data.getJianChaHangYes().contains(temp)) {
					cbBeiJianChaHangYe.setChecked(true);

				} else {

					cbBeiJianChaHangYe.setChecked(false);
				}

				cbBeiJianChaHangYe
						.setButtonDrawable(R.drawable.checkbox_select_style);

				rootLayout.addView(cbBeiJianChaHangYe);

				rootLayout.setTag(cbBeiJianChaHangYe);

				// ‘ˆº”µΩª∫¥ÊºØ∫œ÷–
				cbsJianChaHangYe.add(cbBeiJianChaHangYe);

				jianChaHangYeLayout.addView(rootLayout);

				// ∞Û∂® ¬º˛,µ±≤ºæ÷±ªµ„ª˜µƒ ±∫Ú—°÷–checkbox
				rootLayout.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {

						if (rootLayout.getTag() instanceof CheckBox) {

							CheckBox cbsJianChaHangYe = (CheckBox) rootLayout
									.getTag();

							// Ω´÷∏∂®œÓ—°÷–
							if (cbsJianChaHangYe.isChecked()) {
								cbsJianChaHangYe.setChecked(false);
							} else {
								cbsJianChaHangYe.setChecked(true);
							}

						}

					}
				});

			}

			// µ◊≤øWindow µƒ∑µªÿ∞¥≈•
			ViewGroup btnBottomBack = (ViewGroup) bottomJianChaHangYeWindowLayout
					.findViewById(R.id.btnBack);

			btnBottomBack.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					bottomWindow.dismiss();
				}
			});

			// —°‘Ò«¯”Úµ◊≤øµƒ»∑∂®∞¥≈•
			ViewGroup btnSureJianChaHangYe = (ViewGroup) bottomJianChaHangYeWindowLayout
					.findViewById(R.id.btnSureJianChaHangYe);

			btnSureJianChaHangYe.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					dataBean.data.getJianChaHangYes().clear();

					for (CheckBox checkBox : cbsJianChaHangYe) {

						if (checkBox.getTag() instanceof JianChaHangYe
								&& checkBox.isChecked()) {

							JianChaHangYe hangYe = (JianChaHangYe) checkBox
									.getTag();

							dataBean.data.getJianChaHangYes().add(hangYe);
						}

					}


					sureExecuter.sureJianChaHangYe();
					clearBeijingdanwei();
					SerliazableUtil.saveTemp(dataBean.data,
							user.getUsername());
					bottomWindow.dismiss();
				}
			});

		}
		/**
		 * ≤˙∆∑ºÏ≤‚À˘ Ù«¯”Ú
		 */
		if (v == rl_chanpinjiance_item_suoshuquyu&&!dataBean.checkPlan()) {

			ViewGroup bottomXuanZeQuYuWindowLayout = (ViewGroup) LayoutInflater
					.from(getActivity()).inflate(R.layout.bottom_suanshuquyu2,
							null);

			bottomWindow.show();

			// »√µ◊≤øµƒøÌ∂»∫Õ∆¡ƒªµƒøÌ∂»“ª÷¬
			bottomXuanZeQuYuWindowLayout.setMinimumWidth(getActivity()
					.getWindowManager().getDefaultDisplay().getWidth());

			// …Ë÷√µ◊≤ø≤ºæ÷
			bottomWindow.setContentView(bottomXuanZeQuYuWindowLayout);

			// µØ≥ˆ ‰»Î∑®µƒ≤Ÿ◊˜
			bottomWindow.getWindow().clearFlags(
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

			// …Ë÷√µΩµ◊≤ø
			bottomWindow.getWindow().setGravity(Gravity.BOTTOM);

			/**
			 * º”‘ÿÀ˘—°«¯”Úµƒ»˝∏ˆWheelView
			 */
			final WheelView wvCity = (WheelView) bottomXuanZeQuYuWindowLayout
					.findViewById(R.id.wdCity);

			WheelViewAdapter adpCity = new WheelViewAdapter(getActivity());

			/**
			 * ‘ˆº” –µƒ ˝æ›,∏˘æ›”√ªß–≈œ¢≤È—Øµ•∏ˆ
			 */
			List<Town> citys = new ArrayList<Town>();

			ArrayList<TextInfo> wvCityDatas = new ArrayList<TextInfo>();

			citys.add(dataBean.getData().getTowns()[0]);

			wvCity.setEnabled(false);

			for (Town town : citys) {

				if (town != null) {
					// ÃÌº” –µƒ ˝æ›
					wvCityDatas.add(new TextInfo(town.getCode(), town
							.getName(), town));
				}

			}

			adpCity.setData(wvCityDatas);

			wvCity.setAdapter(adpCity);

			/**
			 * º”‘ÿÀ˘—°«¯”Úµƒ»˝∏ˆWheelView
			 */
			final WheelView wvArea = (WheelView) bottomXuanZeQuYuWindowLayout
					.findViewById(R.id.wdArea);

			WheelViewAdapter adpArea = new WheelViewAdapter(getActivity());

			/**
			 * ‘ˆº”«¯”Úµƒ ˝æ›,∏˘æ›”√ªß–≈œ¢≤È—Øµ•∏ˆ
			 */
			List<Town> areas = db.queryTownByParent(dataBean.getData()
					.getTowns()[0].getCode());

			final ArrayList<TextInfo> wvAreaDatas = new ArrayList<TextInfo>();

			if (dataBean.getData().getTowns()[1] != null
					&& user.getArea() != null) {
				wvArea.setEnabled(false);
			} else {
				wvAreaDatas.add(new TextInfo(-1, "[请选择]", null));

			}

			for (Town town : areas) {
				// ÃÌº” –µƒ ˝æ›
				wvAreaDatas.add(new TextInfo(town.getCode(),
						town.getName(), town));
			}

			adpArea.setData(wvAreaDatas);

			wvArea.setAdapter(adpArea);

			TextInfo areaFilter = null;

			if (dataBean.getData().getTowns()[1] != null) {

				areaFilter = new TextInfo(
						dataBean.getData().getTowns()[1].getCode(), null);
			} else {
				areaFilter = new TextInfo(null, null);
			}

			int position = wvAreaDatas.indexOf(areaFilter);

			position = position < 0 ? 0 : position;

			wvArea.setSelection(position);

			/**
			 * º”‘ÿÀ˘—°«¯”Úµƒ»˝∏ˆWheelView
			 */
			final WheelView wvTown = (WheelView) bottomXuanZeQuYuWindowLayout
					.findViewById(R.id.wdTown);

			final WheelViewAdapter adpTown = new WheelViewAdapter(
					getActivity());

			TextInfo areaInfo = (TextInfo) wvArea.getSelectedItem();

			/**
			 * ‘ˆº”œÁ’Úµƒ ˝æ›
			 */
			List<Town> towns = db.queryTownByParent("" + areaInfo.id);

			final ArrayList<TextInfo> wvTownDatas = new ArrayList<TextInfo>();

			if (dataBean.getData().getTowns()[2] != null
					&& user.getTownId() != null) {
				wvTown.setEnabled(false);
			} else {
				wvTownDatas.add(new TextInfo(-1, "[请选择]", null));
			}

			for (Town town : towns) {

				// ÃÌº” –µƒ ˝æ›
				wvTownDatas.add(new TextInfo(town.getCode(),
						town.getName(), town));

			}

			adpTown.setData(wvTownDatas);

			wvTown.setAdapter(adpTown);

			if (dataBean.getData().getTowns()[2] == null) {
				wvTown.setSelection(0);
			} else {

				TextInfo townFilter = new TextInfo(dataBean.getData()
						.getTowns()[2].getCode(), null);

				position = wvTownDatas.indexOf(townFilter);

				wvTown.setSelection(position);
			}

			wvArea.setOnItemSelectedListener(new OnItemSelectedListener() {

				@Override
				public void onItemSelected(TosAdapterView<?> parent,
										   View view, int position, long id) {

					TextInfo textInfo = wvAreaDatas.get(position);

					wvTownDatas.clear();

					/**
					 * ‘ˆº”œÁ’Úµƒ ˝æ›
					 */
					List<Town> towns = db.queryTownByParent(""
							+ textInfo.id);

					wvTownDatas.add(0, new TextInfo(-1, "[请选择]", null));

					for (Town town : towns) {

						// ÃÌº” –µƒ ˝æ›
						wvTownDatas.add(new TextInfo(town.getCode(), town
								.getName(), town));

					}

					adpTown.notifyDataSetChanged();

					if (wvTownDatas.size() > 1) {

						wvTown.setSelection(1);
					}

				}

				@Override
				public void onNothingSelected(TosAdapterView<?> parent) {
				}
			});

			//aaa
			/**
			 * º”‘ÿÀ˘—°«¯”Úµƒ»˝∏ˆWheelView
			 */
			bottomXuanZeQuYuWindowLayout.findViewById(R.id.wdStreetline).setVisibility(View.VISIBLE);
			final WheelView wvStreet = (WheelView) bottomXuanZeQuYuWindowLayout
					.findViewById(R.id.wdStreet);
			wvStreet.setVisibility(View.VISIBLE);
			final WheelViewAdapter adpStreet = new WheelViewAdapter(
					getActivity());

			TextInfo townInfo = (TextInfo) wvTown.getSelectedItem();

			/**
			 * ‘ˆº”Ω÷µ¿µƒ ˝æ›
			 */
			List<Town> streets = db.queryTownByParent("" + townInfo.id);

			final ArrayList<TextInfo> wvStreetDatas = new ArrayList<TextInfo>();

			if (dataBean.getData().getTowns()[3] != null
					&& user.getStreetId() != null) {
				wvStreet.setEnabled(false);
			} else {
				wvStreetDatas.add(new TextInfo(-1, "[请选择]", null));
			}

			for (Town town : streets) {

				// ÃÌº” –µƒ ˝æ›
				wvStreetDatas.add(new TextInfo(town.getCode(), town
						.getName(), town));

			}

			adpStreet.setData(wvStreetDatas);

			wvStreet.setAdapter(adpStreet);

			if (dataBean.getData().getTowns()[3] == null) {
				wvStreet.setSelection(0);
			} else {

				TextInfo townFilter = new TextInfo(dataBean.getData()
						.getTowns()[3].getCode(), null);

				position = wvStreetDatas.indexOf(townFilter);

				wvStreet.setSelection(position);
			}

			wvTown.setOnItemSelectedListener(new OnItemSelectedListener() {

				@Override
				public void onItemSelected(TosAdapterView<?> parent,
										   View view, int position, long id) {

					TextInfo textInfo = wvTownDatas.get(position);
					wvStreetDatas.clear();
					/**
					 * ‘ˆº”œÁ’Úµƒ ˝æ›
					 */
					List<Town> towns = db.queryTownByParent(""
							+ textInfo.id);

					wvStreetDatas.add(0, new TextInfo(-1, "[请选择]", null));

					for (Town town : towns) {
						// ÃÌº” –µƒ ˝æ›
						wvStreetDatas.add(new TextInfo(town.getCode(), town
								.getName(), town));

					}
					adpStreet.notifyDataSetChanged();


					if (wvStreetDatas.size() > 1) {
						wvStreet.setSelection(1);
					}

				}

				@Override
				public void onNothingSelected(TosAdapterView<?> parent) {
				}
			});


			// µ◊≤øWindow µƒ∑µªÿ∞¥≈•
			ViewGroup btnBottomBack = (ViewGroup) bottomXuanZeQuYuWindowLayout
					.findViewById(R.id.btnBack);

			ViewGroup btnSureXuanZeQuYu = (ViewGroup) bottomXuanZeQuYuWindowLayout
					.findViewById(R.id.btnSureXuanZeQuYu);

			btnBottomBack.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					bottomWindow.dismiss();
				}
			});

			btnSureXuanZeQuYu.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					TextInfo cityTextInfo = (TextInfo) wvCity.getSelectedItem();

					if (cityTextInfo.data instanceof Town) {
						dataBean.getData().getTowns()[0] = (Town) cityTextInfo.data;

					} else {
						dataBean.getData().getTowns()[0] = null;

					}

					TextInfo areaTextInfo = (TextInfo) wvArea.getSelectedItem();

					if (areaTextInfo.data instanceof Town) {

						dataBean.getData().getTowns()[1] = (Town) areaTextInfo.data;

					} else {
						dataBean.getData().getTowns()[1] = null;
					}

					TextInfo townTextInfo = (TextInfo) wvTown.getSelectedItem();

					if (townTextInfo.data instanceof Town) {
						dataBean.getData().getTowns()[2] = (Town) townTextInfo.data;
					} else {
						dataBean.getData().getTowns()[2] = null;
					}


					TextInfo wvStreetd = (TextInfo) wvStreet.getSelectedItem();

					if (wvStreetd.data instanceof Town) {
						dataBean.getData().getTowns()[3] = (Town) wvStreetd.data;
					} else {
						dataBean.getData().getTowns()[3] = null;
					}

					sureExecuter.sureQuYu();

					dataBean.data.setShouJianDanWei(null);

					sureExecuter.sureShouJianDanWei();

					SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

					bottomWindow.dismiss();
				}
			});

		}

		/**
		 * µ„ª˜≥È—˘ª˙ππµƒ ±∫Ú
		 */
		if (v == rl_chanpinjiance_item_chouyangjigou) {

			// ¥À¥¶ø…“‘…Ë÷√dialogœ‘ æµƒŒª÷√ ,œ‘ æ‘⁄µ◊≤ø
			bottomWindow.getWindow().setGravity(Gravity.BOTTOM);

			//  ‰»Î∑®µƒ…Ë÷√
			bottomWindow.getWindow().setFlags(
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

			ViewGroup bottomLayout = (ViewGroup) getActivity()
					.getLayoutInflater().inflate(R.layout.bottom_jianchadanwei,
							null);

			// …Ë÷√»´∆¡
			bottomLayout.setMinimumWidth(getActivity().getWindowManager()
					.getDefaultDisplay().getWidth());

			// µØ≥ˆ∂‘ª∞øÚ∏¯À˚—°‘Ò
			bottomWindow.show();

			bottomWindow.setContentView(bottomLayout);

			// µØ≥ˆ ‰»Î∑®µƒ≤Ÿ◊˜
			bottomWindow.getWindow().clearFlags(
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

			/**
			 * º”‘ÿ ˝æ›πˆ¬÷
			 */
			final WheelView wvBeiJianDanWei = (WheelView) bottomLayout
					.findViewById(R.id.wvJianChaDanWei);

			final WheelViewAdapter adpWheelAdapter = new WheelViewAdapter(
					getActivity());

			wvBeiJianDanWei.setAdapter(adpWheelAdapter);

			ViewGroup btnBottomBack = (ViewGroup) bottomLayout
					.findViewById(R.id.btnBack);

			btnBottomBack.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					bottomWindow.dismiss();
				}
			});

			ViewGroup btnBottomSure = (ViewGroup) bottomLayout
					.findViewById(R.id.btnSureBeiJianDanWei);

			btnBottomSure.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					TextInfo textInfo = (TextInfo) wvBeiJianDanWei
							.getSelectedItem();

					if (textInfo == null) {

						Toast.makeText(getActivity(), "请选择抽验机构...",
								Toast.LENGTH_SHORT).show();

						return;

					}
					boolean ismis=true;
					if (textInfo.data != null
							&& textInfo.data instanceof ChouYanJiGou) {

						dataBean.data
								.setChouYanJiGou((ChouYanJiGou) textInfo.data);
						ChouYanJiGou cy=(ChouYanJiGou) textInfo.data;
						if(cy!=null){
							sureExecuter.sureChouYangJieGuo();
							SerliazableUtil.saveTemp(dataBean.data,
									user.getUsername());
						}else{
							ismis=false;
						}
					}
					if(ismis)
						bottomWindow.dismiss();
				}
			});

			TextView tvTitle = (TextView) bottomLayout
					.findViewById(R.id.tvTitle);

			tvTitle.setText(getString(R.string.chanpinjiance_chouyanjigou_title));

			// ºÏ≤Èµ•Œª∏˘æ›√˚◊÷Ω¯––π˝¬À
			final EditText etBeiJianDanWeiFilter = (EditText) bottomLayout
					.findViewById(R.id.etBeiJianDanWeiFilter);

			TextWatcher textWatcher = new TextWatcher() {

				@Override
				public void onTextChanged(CharSequence s, int start,
										  int before, int count) {

				}

				@Override
				public void beforeTextChanged(CharSequence s, int start,
											  int count, int after) {

				}

				@Override
				public void afterTextChanged(Editable s) {

					if (configUtil.getConfig() == 1) {
						etBeiJianDanWeiFilter.setVisibility(View.INVISIBLE);

						ArrayList<TextInfo> textInfos = new ArrayList<TextInfo>();

						TextInfo textInfo = new TextInfo("-1", "乡镇监管站",
								new ChouYanJiGou("-1", "乡镇监管站"));

						TextInfo textInfo2 = new TextInfo("-2",
								"县（市、区）农产品质检中心", new ChouYanJiGou("-2",
																"县（市、区）农产品质检中心"));
						textInfos.add(textInfo);
						textInfos.add(textInfo2);

						adpWheelAdapter.setData(textInfos);

						return;
					}

					String filter = s.toString().trim();

					//  ˝æ›ºØ∫œ
					List<ChouYanJiGou> datas = null;

					// ≤È—ØÀ˘”–µƒºÏ≤Èµ•Œª–≈œ¢
					if (CharsetUtil.isNotNull(filter)) {
						datas = db.queryAllChouYanJiGou(user.getKnowRegion()
								+ "", filter);

						if (datas.size() < 1) {
							//datas.add(new ChouYanJiGou("0", filter));
						}

					} else {
						datas = db.queryAllChouYanJiGou(user.getKnowRegion()
								+ "");
					}

					ArrayList<TextInfo> textInfos = new ArrayList<TextInfo>();

					for (ChouYanJiGou data : datas) {

						Object id = null;

						String name = null;

						if (data instanceof ChouYanJiGou) {
							id = ((ChouYanJiGou) data).getId();
							name = ((ChouYanJiGou) data).getName();
						}

						TextInfo textInfo = new TextInfo(id, name, data);

						textInfos.add(textInfo);
					}

					adpWheelAdapter.setData(textInfos);

				}
			};

			etBeiJianDanWeiFilter.addTextChangedListener(textWatcher);

			// µ±ø™ ºµƒ ±∫Ú¥´µ›ø’µƒΩ¯»•
			textWatcher.afterTextChanged(new SpannableStringBuilder(""));

			if (dataBean.checkChouYanJiGou()) {

				TextInfo textInfo = new TextInfo(dataBean.getData()
						.getChouYanJiGou().getId(), dataBean.getData()
						.getChouYanJiGou().getName());

				int position = adpWheelAdapter.getPosition(textInfo);

				if (position > -1) {
					wvBeiJianDanWei.setSelection(position);
				} else {
					etBeiJianDanWeiFilter.setText(dataBean.getData()
							.getChouYanJiGou().getName());

					textWatcher.afterTextChanged(new SpannableStringBuilder(
							dataBean.getData().getChouYanJiGou().getName()));
				}

			}

		}

		/*
		 * µ„ª˜≥È—˘»À‘±µƒ ±∫Ú
		 */
		if (v == rl_chanpinjiance_item_chouyangrenyuan) {
			Intent to_chouyangrenyuan_intent = new Intent(getActivity(),
					ListViewCheckManagerActivity.class);

			if (dataBean.getData().getChouYangRenYuans().size() > 0) {
				to_chouyangrenyuan_intent
						.putExtra("data", (Serializable) dataBean.getData()
								.getChouYangRenYuans());
			}

			// Ω´”√ªß∂‘œÛ¥´µ›π˝»•
			to_chouyangrenyuan_intent.putExtra("user", user);

			// “ÚŒ™ «π´”√µƒ,À˘“‘–Ë“™≈–∂œ
			to_chouyangrenyuan_intent.putExtra("type", "renyuan");

			// ¥´µ›±ÍÃ‚
			to_chouyangrenyuan_intent.putExtra("title",
					getString(R.string.chanpinjiance_chouyangrenyuan_title));

			startActivityForResult(to_chouyangrenyuan_intent,
					TO_LISTVIEWCHECKMANAGER_REQUEST_CODE);

		}
		/*huanjie xrf*/
		if(rl_jianchehuanjie==v){


			bottomWindow.show();
			page=0;
			// »√µ◊≤øµƒøÌ∂»∫Õ∆¡ƒªµƒøÌ∂»“ª÷¬
			ViewGroup bottomBeiJianDanWeiWindowLayout = (ViewGroup) getActivity()
					.getLayoutInflater().inflate(R.layout.bottom_jianchaneirong,
							null);

			bottomBeiJianDanWeiWindowLayout.setMinimumWidth(getActivity()
					.getWindowManager().getDefaultDisplay().getWidth());

			// …Ë÷√µ◊≤ø≤ºæ÷
			bottomWindow.setContentView(bottomBeiJianDanWeiWindowLayout);

			// µØ≥ˆ ‰»Î∑®µƒ≤Ÿ◊˜
			bottomWindow.getWindow().clearFlags(
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

			bottomWindow.getWindow().setGravity(Gravity.BOTTOM);

			// Ω¯––±ÍÃ‚µƒ∞Û∂®
			TextView tvTitle = (TextView) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.bottomTitle);
			tvTitle.setText("监测环节");
			/**
			 * Ω¯–– ”Õºµƒ∂ØÃ¨…˙≥…
			 */
			ViewGroup layout = (ViewGroup) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.jianchaneironglayout);
			// «Â¿Ì ”Õº
			layout.removeAllViews();

			// ≤È—Ø≥ˆÀ˘”–ºÏ≤È––“µ
			List<Huanjie> huanjies = Huanjie.getLists();
			if(dataBean.checkPlan())
				huanjies=Huanjie.getLists(dataBean.getPlan().getAllowSection());
			final List<CheckBox> cbsCheckBoxs = new ArrayList<CheckBox>();

			// ±È¿˙ºÏ≤È––“µΩ¯–– ”Õºµƒ…˙≥…
			for (final Huanjie item : huanjies) {

				final RelativeLayout rootLayout = new RelativeLayout(
						getActivity());

				MarginLayoutParams rootLayoutPrams = new MarginLayoutParams(
						MarginLayoutParams.MATCH_PARENT,
						MarginLayoutParams.WRAP_CONTENT);

				rootLayoutPrams.setMargins(0, Utils.dip2px(getActivity(), 3),
						0, Utils.dip2px(getActivity(), 3));

				// ºÊ»›µÕ∞Ê±æ…Ë÷√margin∑Ω∑®
				LayoutParams layoutPrarams = new LayoutParams(rootLayoutPrams);
				layoutPrarams.gravity = Gravity.TOP | Gravity.LEFT;

				rootLayout.setLayoutParams(layoutPrarams);
				rootLayout.setClickable(true);
				rootLayout.setGravity(Gravity.CENTER_VERTICAL);
				rootLayout.setPadding(Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 5),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 5));
				rootLayout
						.setBackgroundResource(R.drawable.jiandujiancha_item_style);

				/*********************************************/
				TextView tvItemTitle = new TextView(getActivity());

				RelativeLayout.LayoutParams rlItemLayout = new RelativeLayout.LayoutParams(
						RelativeLayout.LayoutParams.WRAP_CONTENT,
						RelativeLayout.LayoutParams.WRAP_CONTENT);
				rlItemLayout.addRule(RelativeLayout.CENTER_VERTICAL);
				tvItemTitle.setLayoutParams(rlItemLayout);

				tvItemTitle.setPadding(Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8));
				tvItemTitle.setTextColor(Color.parseColor("#656769"));
				tvItemTitle.setTextSize(20);
				tvItemTitle.setText(item.getName());

				rootLayout.addView(tvItemTitle);

				/*********************************************/

				CheckBox cbCheckBox = new CheckBox(getActivity());

				/**
				 * «Â¿Ì∂‡—°
				 */
				cbCheckBox
						.setOnCheckedChangeListener(new OnCheckedChangeListener() {

							@Override
							public void onCheckedChanged(
									CompoundButton buttonView, boolean isChecked) {

								/**
								 * µ•—°,«Â¿Ìcheckbox
								 */
								for (CheckBox checkBox : cbsCheckBoxs) {
									checkBox.setChecked(false);
								}

								buttonView.setChecked(isChecked);

							}
						});

				cbCheckBox.setTag(item);

				RelativeLayout.LayoutParams cbBeiJianChaHangYeLayout = new RelativeLayout.LayoutParams(
						RelativeLayout.LayoutParams.WRAP_CONTENT,
						RelativeLayout.LayoutParams.WRAP_CONTENT);
				cbBeiJianChaHangYeLayout
						.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
				cbBeiJianChaHangYeLayout
						.addRule(RelativeLayout.CENTER_VERTICAL);
				cbCheckBox.setLayoutParams(cbBeiJianChaHangYeLayout);

				if (item.equals(dataBean.data.getHuanjie())||huanjies.size()==1) {
					cbCheckBox.setChecked(true);
				} else {
					cbCheckBox.setChecked(false);
				}

				cbCheckBox.setButtonDrawable(R.drawable.checkbox_select_style);

				rootLayout.addView(cbCheckBox);

				rootLayout.setTag(cbCheckBox);

				// ‘ˆº”µΩª∫¥ÊºØ∫œ÷–
				cbsCheckBoxs.add(cbCheckBox);

				layout.addView(rootLayout);

				// ∞Û∂® ¬º˛,µ±≤ºæ÷±ªµ„ª˜µƒ ±∫Ú—°÷–checkbox
				rootLayout.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {

						if (rootLayout.getTag() instanceof CheckBox) {

							CheckBox cbsJianChaNeiRong = (CheckBox) rootLayout
									.getTag();

							// Ω´÷∏∂®œÓ—°÷–
							if (cbsJianChaNeiRong.isChecked()) {
								cbsJianChaNeiRong.setChecked(false);
							} else {
								cbsJianChaNeiRong.setChecked(true);
							}

						}

					}
				});

			}

			// µ◊≤øWindow µƒ∑µªÿ∞¥≈•
			ViewGroup btnBottomBack = (ViewGroup) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.btnBack);

			btnBottomBack.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					bottomWindow.dismiss();
				}
			});

			// —°‘Ò«¯”Úµ◊≤øµƒ»∑∂®∞¥≈•
			ViewGroup btnSure = (ViewGroup) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.btnSureJianChaNeiRong);

			btnSure.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					dataBean.data.setHuanjie(null);

					for (CheckBox checkBox : cbsCheckBoxs) {

						if (checkBox.getTag() instanceof Huanjie
								&& checkBox.isChecked()) {

							Huanjie data = (Huanjie) checkBox
									.getTag();

							dataBean.data.setHuanjie(data);

							break;
						}

					}

					sureExecuter.sureHuanjie();

					SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

					bottomWindow.dismiss();

				}
			});


		}
		/**
		 * µ„ª˜≥È—˘µ•Œªµƒ ±∫Úrafe ent
		 */
		if (rl_chanpinjiance_item_shoujiandanwei == v) {

			Intent intent = new Intent(getActivity(),CheckActivity.class);
			intent.putExtra("user", user);
			if(dataBean.checkPlan()){
				// “ÚŒ™ «π´”√µƒ,À˘“‘–Ë“™≈–∂œ
				intent.putExtra("planId",dataBean.getPlan().getId());
			}else{
				intent.putExtra("planId", "");
			}
			intent.putExtra("ent",dataBean.data.getShouJianDanWei());

			startActivityForResult(intent, TO_SELENTS);

		}
		if (rl_chanpinjiance_item_shoujiandanwei == null) {
			//check v1609
			if(!dataBean.checkQuYu()){
				//
				//					DialogUtil.showMessageDialog("«Î—°‘ÒÀ˘ Ù«¯”ÚµΩ«¯’Úº∂..", null, getActivity());
				//                   return;
			}

			bottomWindow.show();
			page=0;
			// »√µ◊≤øµƒøÌ∂»∫Õ∆¡ƒªµƒøÌ∂»“ª÷¬
			ViewGroup bottomBeiJianDanWeiWindowLayout = (ViewGroup) getActivity()
					.getLayoutInflater().inflate(R.layout.bottom_beijiandanwei2,
							null);

			bottomBeiJianDanWeiWindowLayout.setMinimumWidth(getActivity()
					.getWindowManager().getDefaultDisplay().getWidth());

			// …Ë÷√µ◊≤ø≤ºæ÷
			bottomWindow.setContentView(bottomBeiJianDanWeiWindowLayout);

			// µØ≥ˆ ‰»Î∑®µƒ≤Ÿ◊˜
			bottomWindow.getWindow().clearFlags(
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

			bottomWindow.getWindow().setGravity(Gravity.BOTTOM);

			// Ω¯––±ÍÃ‚µƒ∞Û∂®
			TextView tvTitle = (TextView) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.tvTitle);
			tvTitle.setText(getString(R.string.chanpinjiance_shoujiandanwei_title));


			/**
			 * º”‘ÿ±ªºÏµ•Œª
			 */
			final ListView wvBeiJianDanWei=(ListView)bottomBeiJianDanWeiWindowLayout.findViewById(R.id.dataview);



			final ListAdapter adpBeiJianDanWeiAdapter = new ListAdapter(
					getActivity());
			wvBeiJianDanWei.setOnItemClickListener(new OnItemClickListener(){
				@Override
				public void onItemClick(AdapterView<?> arg0, View arg1,
										int arg2, long arg3) {
					wvBeiJianDanWei.setTag(arg2);
					adpBeiJianDanWeiAdapter.setSelectItem(arg2);
					adpBeiJianDanWeiAdapter.notifyDataSetInvalidated();

				}});
			wvBeiJianDanWei.setAdapter(adpBeiJianDanWeiAdapter);


			final EditText etBeiJianDanWeiFilter = (EditText) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.etBeiJianDanWeiFilter);
			class onPage  {
				public void onClick(int arg0) {
					String filter = etBeiJianDanWeiFilter.getText().toString().trim();

					List<BeiJianDanWei> beiJianDanWeis = null;
					String where="";
					if(dataBean.checkPlan()){

						if(dataBean.data.getDuixiangleixing().size()>0){

							where+=dataBean.data.sqlDuixiangleixing();
						}else{
							where+=dataBean.data.sqlDuixiangleixing(dataBean.getPlan().arrayEntKinds());

						}

						if(dataBean.data.getJianChaHangYes().size()>0){
							where+=dataBean.data.sqlJiaChaHangYes();
						}else{
							where+= dataBean.data.sqlJianChaHangYes(dataBean.getPlan().arrayEntTrade());
						}

						if(dataBean.getPlan().getEntCount()>0){

							JSONArray entss=db.queryAllPlanEnt(dataBean.getPlan().getId());
							String sqlents=" AND ( 1=0 ";
							for(int t=0;t<entss.length();t++){
								sqlents+=" or ID='"+entss.optJSONObject(t).optString("entId")+"'";

							}
							where+=sqlents+")";


						}
					}

					if (CharsetUtil.isNotNull(filter)) {

						if(where.equals("")) {
							beiJianDanWeis = db.queryAllBeiJianDanWie(filter,
									dataBean.getKnowCode() + "",page,dataBean.data.sqlDuixiangleixing(),dataBean.data.sqlJiaChaHangYes());
						}else{
							beiJianDanWeis = db.queryAllBeiJianDanWieByWhere(filter,
									dataBean.getKnowCode() + "",page," 1=1 "+where);

						}

						if (beiJianDanWeis.size() < 1) {
							beiJianDanWeis.add(new BeiJianDanWei("0",
									filter));
						}
					} else {

						if(where.equals(""))
							beiJianDanWeis = db.queryAllBeiJianDanWie(dataBean
									.getKnowCode() + "",page,dataBean.data.sqlDuixiangleixing(),dataBean.data.sqlJiaChaHangYes());
						else
							beiJianDanWeis = db.queryAllBeiJianDanWieByWhere(dataBean
									.getKnowCode() + "",page," 1=1 "+where);

					}

					ArrayList<TextInfo> wvBeiJianDanWeiDatas = new ArrayList<TextInfo>();

					for (BeiJianDanWei beiJianDanWei : beiJianDanWeis) {
						TextInfo textInfo = new TextInfo(
								beiJianDanWei.getId(),
								beiJianDanWei.getName(), beiJianDanWei);

						wvBeiJianDanWeiDatas.add(textInfo);
					}
					adpBeiJianDanWeiAdapter.setData(wvBeiJianDanWeiDatas);
				}}
			final onPage pager=new onPage();
			bottomBeiJianDanWeiWindowLayout.findViewById(R.id.pageLeft).setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					page--;
					if(page<0){
						page=0;
					}
					pager.onClick(0);
				}
			});
			bottomBeiJianDanWeiWindowLayout.findViewById(R.id.pageRight).setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					page++;
					pager.onClick(0);
				}
			});
			//zl

			ViewGroup btnBottomBack = (ViewGroup) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.btnBack);

			btnBottomBack.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					bottomWindow.dismiss();
				}
			});

			ViewGroup beiJianDanWeiBommtomSure = (ViewGroup) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.btnSure);

			beiJianDanWeiBommtomSure.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {


					if(wvBeiJianDanWei.getTag()==null)return;
					int sel=java.lang.Integer.parseInt(String.valueOf(wvBeiJianDanWei.getTag()));
					TextInfo textInfo = (TextInfo) adpBeiJianDanWeiAdapter.getItem(sel);


					if (textInfo != null && textInfo.data != null) {

						dataBean.getData().setShouJianDanWei(
								(BeiJianDanWei) textInfo.data);

					} else {
						dataBean.getData().setShouJianDanWei(null);
					}

					// »Áπ˚¥Ê‘⁄ ‹ºÏµ•Œª
					if (dataBean.checkShouJianDanWei()) {

						// if (!dataBean.checkTongXunDiZhi()
						// || !dataBean.checkFuZeRen()
						// || !dataBean.checkLianXiFangShi()) {

						int shouJianDanWeiCount = db
								.queryCountBeiJianDanWeiByName(dataBean.data
										.getShouJianDanWei().getName(),dataBean.data.getShouJianDanWei().getCode());

						// »Áπ˚ ‹ºÏµ•Œª≤ª¥Ê‘⁄
						if (shouJianDanWeiCount < 1) {
							final CustomDialog createShouJianDanWeiDialog = new CustomDialog(
									getActivity());

							createShouJianDanWeiDialog.setHeightPercent(0.4f);

							createShouJianDanWeiDialog
									.setOnActionClickListener(new OnClickListener() {

										@Override
										public void onClick(View v) {

											// ”√ªß—°‘Ò∑Ò,±Ì æ”√ªß≤ªœ£Õ˚¥¥Ω®ÃÓ–¥–≈œ¢,∑˛ŒÒ∆˜jsonŒ™trueµƒ ±∫Ú≤ª¥¥Ω®
											dataBean.data.getShouJianDanWei()
													.setCreateShouJianDanWei(
															false);

											dataBean.data.getShouJianDanWei()
													.setAddress(null);
											dataBean.data.getShouJianDanWei()
													.setTel(null);
											dataBean.data.getShouJianDanWei()
													.setCharge(null);

											createShouJianDanWeiDialog
													.dismiss();

											//  «∑Ò¥¥Ω®µƒ◊¥Ã¨∏ƒ±‰,÷ÿ–¬»∑∂®≤ºæ÷
											sureExecuter.sureShouJianDanWei();

											sureExecuter.sureTongXunDiZhi();
											sureExecuter.sureLianXiFangShi();
											sureExecuter.sureFuZeRen();

										}
									});

							createShouJianDanWeiDialog
									.setOnCancleClickListener(new OnClickListener() {

										@Override
										public void onClick(View v) {
											dataBean.data.getShouJianDanWei()
													.setCreateShouJianDanWei(
															true);

											dataBean.data.getShouJianDanWei()
													.setAddress(null);
											dataBean.data.getShouJianDanWei()
													.setTel(null);
											dataBean.data.getShouJianDanWei()
													.setCharge(null);

											createShouJianDanWeiDialog
													.dismiss();

											//  «∑Ò¥¥Ω®µƒ◊¥Ã¨∏ƒ±‰,÷ÿ–¬»∑∂®≤ºæ÷
											sureExecuter.sureShouJianDanWei();

											sureExecuter.sureTongXunDiZhi();
											sureExecuter.sureLianXiFangShi();
											sureExecuter.sureFuZeRen();

										}
									});


							createShouJianDanWeiDialog
									.setNote("是，在监管平台中自动创建一个当前名称的监管对象，稍后请到监管平台网上补全资料；\n否，则该单位不会作为被监管的对象，不出现在监管平台的监管对象中。");

							createShouJianDanWeiDialog.setCancleTxt("是");

							createShouJianDanWeiDialog.setActionTxt("否");

							createShouJianDanWeiDialog
																.setMessage("受检单位不存在,是否创建？");

							createShouJianDanWeiDialog.show();
						} else {

							// ”√ªß¥”¡–±Ì÷–—°‘Ò,≤ª¥¥Ω®,¥´true
							dataBean.data.getShouJianDanWei()
									.setCreateShouJianDanWei(false);
						}
					}

					// }

					sureExecuter.sureShouJianDanWei();

					SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

					bottomWindow.dismiss();
				}
			});
			// ºÏ≤Èµ•Œª∏˘æ›√˚◊÷Ω¯––π˝¬À
			bottomBeiJianDanWeiWindowLayout.findViewById(R.id.btn_search).setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View arg0) {
					pager.onClick(0);
				}});

			pager.onClick(0);
		}

		/**
		 * µ„ª˜Õ®—∂µÿ÷∑
		 */
		if (rlChouYangDanWeiAdress == v) {

			bottomWindow.show();

			// »√µ◊≤øµƒøÌ∂»∫Õ∆¡ƒªµƒøÌ∂»“ª÷¬
			ViewGroup bottomBeiJianDanWeiWindowLayout = (ViewGroup) getActivity()
					.getLayoutInflater().inflate(
							R.layout.bottom_photodetail_comment, null);

			bottomBeiJianDanWeiWindowLayout.setMinimumWidth(getActivity()
					.getWindowManager().getDefaultDisplay().getWidth());

			// …Ë÷√µ◊≤ø≤ºæ÷
			bottomWindow.setContentView(bottomBeiJianDanWeiWindowLayout);

			// µØ≥ˆ ‰»Î∑®µƒ≤Ÿ◊˜
			bottomWindow.getWindow().clearFlags(
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

			bottomWindow.getWindow().setGravity(Gravity.BOTTOM);

			TextView tvTitle = (TextView) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.tvTitle);

			tvTitle.setText(getString(R.string.chanpinjiance_txdz_title));

			final TextView edtContent = (TextView) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.edtCommentPhoto);

			edtContent.setHint("请输入通讯地址");

			//  ˝æ›ªπ‘≠
			if (dataBean.checkTongXunDiZhi()) {
				edtContent.setText(dataBean.data.getShouJianDanWei()
						.getAddress());
			}

			// …Ë÷√◊Ó∂‡30∏ˆ◊÷∑˚
			edtContent
					.setFilters(new InputFilter[] { new InputFilter.LengthFilter(
							30) });

			ViewGroup btnBack = (ViewGroup) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.btnBack);

			btnBack.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					bottomWindow.dismiss();
				}
			});

			ViewGroup btnSure = (ViewGroup) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.btnSure);

			btnSure.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					String address = edtContent.getText().toString().trim();

					if (!CharsetUtil.isNotNull(address)) {

						Toast.makeText(getActivity(), "请输入通讯地址...",
								Toast.LENGTH_SHORT).show();

						return;
					}

					// …Ë÷√Õ®—∂µÿ÷∑
					dataBean.data.getShouJianDanWei().setAddress(address);

					sureExecuter.sureTongXunDiZhi();

					SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

					bottomWindow.dismiss();
				}
			});

		}

		/**
		 * µ„ª˜∏∫‘»Àµƒ ±∫Ú
		 */
		if (rlChouYangDanWeiFuZeRen == v) {

			bottomWindow.show();

			// »√µ◊≤øµƒøÌ∂»∫Õ∆¡ƒªµƒøÌ∂»“ª÷¬
			ViewGroup bottomBeiJianDanWeiWindowLayout = (ViewGroup) getActivity()
					.getLayoutInflater().inflate(
							R.layout.bottom_photodetail_comment, null);

			bottomBeiJianDanWeiWindowLayout.setMinimumWidth(getActivity()
					.getWindowManager().getDefaultDisplay().getWidth());

			// …Ë÷√µ◊≤ø≤ºæ÷
			bottomWindow.setContentView(bottomBeiJianDanWeiWindowLayout);

			// µØ≥ˆ ‰»Î∑®µƒ≤Ÿ◊˜
			bottomWindow.getWindow().clearFlags(
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

			bottomWindow.getWindow().setGravity(Gravity.BOTTOM);

			TextView tvTitle = (TextView) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.tvTitle);

			tvTitle.setText(getString(R.string.chanpinjiance_fzr_title));

			final TextView edtContent = (TextView) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.edtCommentPhoto);

			edtContent.setHint("请输入负责人姓名");

			//  ˝æ›ªπ‘≠
			if (dataBean.checkFuZeRen()) {
				edtContent.setText(dataBean.data.getShouJianDanWei()
						.getCharge());
			}

			// …Ë÷√◊Ó∂‡30∏ˆ◊÷∑˚
			edtContent
					.setFilters(new InputFilter[] { new InputFilter.LengthFilter(
							6) });

			ViewGroup btnBack = (ViewGroup) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.btnBack);

			btnBack.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					bottomWindow.dismiss();
				}
			});

			ViewGroup btnSure = (ViewGroup) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.btnSure);

			btnSure.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					String charge = edtContent.getText().toString().trim();

					if (!CharsetUtil.isNotNull(charge)) {

						Toast.makeText(getActivity(), "请输入负责人姓名...",
								Toast.LENGTH_SHORT).show();

						return;
					}

					if (charge.length() > 4) {

						Toast.makeText(getActivity(), " 输入负责人姓名非法...超过了4个字",
								Toast.LENGTH_SHORT).show();

						return;
					}

					// …Ë÷√Õ®—∂µÿ÷∑
					dataBean.data.getShouJianDanWei().setCharge(charge);

					sureExecuter.sureFuZeRen();

					SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

					bottomWindow.dismiss();
				}
			});

		}

		/**
		 * µ„ª˜¡™œµ∑Ω Ω
		 */
		if (rlChouYangDanWeiLianXiFangShi == v) {

			bottomWindow.show();

			// »√µ◊≤øµƒøÌ∂»∫Õ∆¡ƒªµƒøÌ∂»“ª÷¬
			ViewGroup bottomBeiJianDanWeiWindowLayout = (ViewGroup) getActivity()
					.getLayoutInflater().inflate(
							R.layout.bottom_photodetail_comment, null);

			bottomBeiJianDanWeiWindowLayout.setMinimumWidth(getActivity()
					.getWindowManager().getDefaultDisplay().getWidth());

			// …Ë÷√µ◊≤ø≤ºæ÷
			bottomWindow.setContentView(bottomBeiJianDanWeiWindowLayout);

			// µØ≥ˆ ‰»Î∑®µƒ≤Ÿ◊˜
			bottomWindow.getWindow().clearFlags(
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

			bottomWindow.getWindow().setGravity(Gravity.BOTTOM);

			TextView tvTitle = (TextView) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.tvTitle);

			tvTitle.setText(getString(R.string.chanpinjiance_lxfs_title));

			final TextView edtContent = (TextView) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.edtCommentPhoto);

			edtContent.setHint("请输入联系人的手机或座机号码");

			//  ˝æ›ªπ‘≠
			if (dataBean.checkLianXiFangShi()) {
				edtContent.setText(dataBean.data.getShouJianDanWei()
						.getMobile());
			}

			// …Ë÷√÷ª‘ –Ì ‰»Î∫≈¬Î
			edtContent.setInputType(InputType.TYPE_CLASS_PHONE);

			int minHeight = Utils.dip2px(getActivity(), 150);

			edtContent.setMinHeight(minHeight);

			// …Ë÷√◊Ó∂‡ ‰»Îµƒ◊÷∑˚∏ˆ ˝
			edtContent
					.setFilters(new InputFilter[] { new InputFilter.LengthFilter(
							13) });

			ViewGroup btnBack = (ViewGroup) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.btnBack);

			btnBack.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					bottomWindow.dismiss();
				}
			});

			ViewGroup btnSure = (ViewGroup) bottomBeiJianDanWeiWindowLayout
					.findViewById(R.id.btnSure);

			btnSure.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					String mobile = edtContent.getText().toString().trim();

					if (!CharsetUtil.isNotNull(mobile)) {

						Toast.makeText(getActivity(), "请输入号码...",
								Toast.LENGTH_SHORT).show();

						return;
					}

					if (!CharsetUtil.checkPhone(mobile)) {
						Toast.makeText(getActivity(), " 输入号码的号码格式错误...",
								Toast.LENGTH_SHORT).show();

						return;
					}

					// …Ë÷√Õ®—∂µÿ÷∑
					dataBean.data.getShouJianDanWei().setMobile(mobile);

					sureExecuter.sureLianXiFangShi();

					SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

					bottomWindow.dismiss();
				}
			});

		}

		/**
		 * µ„ª˜»ŒŒÒ¿¥‘¥µƒ ±∫Ú
		 */
		if (v == rl_chanpinjiance_item_renwulaiyuan) {

			bottomWindow.show();

			/**
			 * ºÏ≤È––“µµ◊≤øµƒ≤ºæ÷
			 */
			ViewGroup bottomLayout = (ViewGroup) getActivity()
					.getLayoutInflater().inflate(
							R.layout.bottom_jianchaneirong, null);

			// »√µ◊≤øµƒøÌ∂»∫Õ∆¡ƒªµƒøÌ∂»“ª÷¬
			bottomLayout.setMinimumWidth(getActivity().getWindowManager()
					.getDefaultDisplay().getWidth());

			// …Ë÷√µ◊≤ø≤ºæ÷
			bottomWindow.setContentView(bottomLayout);

			// µØ≥ˆ ‰»Î∑®µƒ≤Ÿ◊˜
			bottomWindow.getWindow().clearFlags(
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

			bottomWindow.getWindow().setGravity(Gravity.BOTTOM);

			// …Ë÷√±ÍÃ‚

			TextView tvTitle = (TextView) bottomLayout
					.findViewById(R.id.bottomTitle);

			tvTitle.setText(getString(R.string.chanpinjiance_renwulaiyuan_title));

			/**
			 * Ω¯–– ”Õºµƒ∂ØÃ¨…˙≥…
			 */
			ViewGroup layout = (ViewGroup) bottomLayout
					.findViewById(R.id.jianchaneironglayout);
			// «Â¿Ì ”Õº
			layout.removeAllViews();

			// ≤È—Ø≥ˆÀ˘”–ºÏ≤È––“µ
			List<RenWuLaiYuan> renWuLaiYuans = db.queryAllRenWuLaiYuan();

			final List<CheckBox> cbsCheckBoxs = new ArrayList<CheckBox>();

			// ±È¿˙ºÏ≤È––“µΩ¯–– ”Õºµƒ…˙≥…
			for (final RenWuLaiYuan temp : renWuLaiYuans) {

				final RelativeLayout rootLayout = new RelativeLayout(
						getActivity());

				MarginLayoutParams rootLayoutPrams = new MarginLayoutParams(
						MarginLayoutParams.MATCH_PARENT,
						MarginLayoutParams.WRAP_CONTENT);

				rootLayoutPrams.setMargins(0, Utils.dip2px(getActivity(), 3),
						0, Utils.dip2px(getActivity(), 3));

				// ºÊ»›µÕ∞Ê±æ…Ë÷√margin∑Ω∑®
				LayoutParams layoutPrarams = new LayoutParams(rootLayoutPrams);
				layoutPrarams.gravity = Gravity.TOP | Gravity.LEFT;

				rootLayout.setLayoutParams(layoutPrarams);
				rootLayout.setClickable(true);
				rootLayout.setGravity(Gravity.CENTER_VERTICAL);
				rootLayout.setPadding(Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 5),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 5));
				rootLayout
						.setBackgroundResource(R.drawable.jiandujiancha_item_style);

				/*********************************************/
				TextView tvItemTitle = new TextView(getActivity());

				RelativeLayout.LayoutParams rlItemLayout = new RelativeLayout.LayoutParams(
						RelativeLayout.LayoutParams.WRAP_CONTENT,
						RelativeLayout.LayoutParams.WRAP_CONTENT);
				rlItemLayout.addRule(RelativeLayout.CENTER_VERTICAL);
				tvItemTitle.setLayoutParams(rlItemLayout);

				tvItemTitle.setPadding(Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8));
				tvItemTitle.setTextColor(Color.parseColor("#656769"));
				tvItemTitle.setTextSize(20);
				tvItemTitle.setText(temp.getName());

				rootLayout.addView(tvItemTitle);

				/*********************************************/

				CheckBox cbCheckBox = new CheckBox(getActivity());

				/**
				 * «Â¿Ì∂‡—°
				 */
				cbCheckBox
						.setOnCheckedChangeListener(new OnCheckedChangeListener() {

							@Override
							public void onCheckedChanged(
									CompoundButton buttonView, boolean isChecked) {

								/**
								 * µ•—°,«Â¿Ìcheckbox
								 */
								for (CheckBox checkBox : cbsCheckBoxs) {
									checkBox.setChecked(false);
								}

								buttonView.setChecked(isChecked);

							}
						});

				cbCheckBox.setTag(temp);

				RelativeLayout.LayoutParams cbBeiJianChaHangYeLayout = new RelativeLayout.LayoutParams(
						RelativeLayout.LayoutParams.WRAP_CONTENT,
						RelativeLayout.LayoutParams.WRAP_CONTENT);
				cbBeiJianChaHangYeLayout
						.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
				cbBeiJianChaHangYeLayout
						.addRule(RelativeLayout.CENTER_VERTICAL);
				cbCheckBox.setLayoutParams(cbBeiJianChaHangYeLayout);

				if (temp.equals(dataBean.data.getRenWuLaiYuan())) {
					cbCheckBox.setChecked(true);
				} else {
					cbCheckBox.setChecked(false);
				}

				cbCheckBox.setButtonDrawable(R.drawable.checkbox_select_style);

				rootLayout.addView(cbCheckBox);

				rootLayout.setTag(cbCheckBox);

				// ‘ˆº”µΩª∫¥ÊºØ∫œ÷–
				cbsCheckBoxs.add(cbCheckBox);

				layout.addView(rootLayout);

				// ∞Û∂® ¬º˛,µ±≤ºæ÷±ªµ„ª˜µƒ ±∫Ú—°÷–checkbox
				rootLayout.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {

						if (rootLayout.getTag() instanceof CheckBox) {

							CheckBox cbsJianChaNeiRong = (CheckBox) rootLayout
									.getTag();

							// Ω´÷∏∂®œÓ—°÷–
							if (cbsJianChaNeiRong.isChecked()) {
								cbsJianChaNeiRong.setChecked(false);
							} else {
								cbsJianChaNeiRong.setChecked(true);
							}

						}

					}
				});

			}

			// µ◊≤øWindow µƒ∑µªÿ∞¥≈•
			ViewGroup btnBottomBack = (ViewGroup) bottomLayout
					.findViewById(R.id.btnBack);

			btnBottomBack.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					bottomWindow.dismiss();
				}
			});

			// —°‘Ò«¯”Úµ◊≤øµƒ»∑∂®∞¥≈•
			ViewGroup btnSure = (ViewGroup) bottomLayout
					.findViewById(R.id.btnSureJianChaNeiRong);

			btnSure.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					dataBean.data.setRenWuLaiYuan(null);

					for (CheckBox checkBox : cbsCheckBoxs) {

						if (checkBox.getTag() instanceof RenWuLaiYuan
								&& checkBox.isChecked()) {

							RenWuLaiYuan data = (RenWuLaiYuan) checkBox
									.getTag();

							dataBean.data.setRenWuLaiYuan(data);

							break;
						}

					}

					sureExecuter.sureRenWuLaiYuan();

					SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

					bottomWindow.dismiss();

				}
			});

		}

		/**
		 * µ±µ„ª˜ºÏ—È¿‡±µƒ ±∫Úrafe1
		 */
		if (v == rl_chanpinjiance_item_jianyanleibie) {

			bottomWindow.show();


			/**
			 * ºÏ≤È––“µµ◊≤øµƒ≤ºæ÷
			 */
			ViewGroup bottomLayout = (ViewGroup) getActivity()
					.getLayoutInflater().inflate(
							R.layout.bottom_jianchaneirong, null);

			// »√µ◊≤øµƒøÌ∂»∫Õ∆¡ƒªµƒøÌ∂»“ª÷¬
			bottomLayout.setMinimumWidth(getActivity().getWindowManager()
					.getDefaultDisplay().getWidth());

			// …Ë÷√µ◊≤ø≤ºæ÷
			bottomWindow.setContentView(bottomLayout);

			// µØ≥ˆ ‰»Î∑®µƒ≤Ÿ◊˜
			bottomWindow.getWindow().clearFlags(
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

			bottomWindow.getWindow().setGravity(Gravity.BOTTOM);

			// …Ë÷√±ÍÃ‚

			TextView tvTitle = (TextView) bottomLayout
					.findViewById(R.id.bottomTitle);

			tvTitle.setText(getString(R.string.chanpinjiance_jianyanleibie_title));

			/**
			 * Ω¯–– ”Õºµƒ∂ØÃ¨…˙≥…
			 */
			ViewGroup layout = (ViewGroup) bottomLayout
					.findViewById(R.id.jianchaneironglayout);
			// «Â¿Ì ”Õº
			layout.removeAllViews();

			// ≤È—Ø≥ˆÀ˘”–ºÏ≤È––“µ
			List<JianCeLeiBie> jianYanLeiBies = db.queryAllJianYanLeiBie();

			final List<CheckBox> cbsCheckBoxs = new ArrayList<CheckBox>();

			// ±È¿˙ºÏ≤È––“µΩ¯–– ”Õºµƒ…˙≥…
			for (final JianCeLeiBie temp : jianYanLeiBies) {

				final RelativeLayout rootLayout = new RelativeLayout(
						getActivity());

				MarginLayoutParams rootLayoutPrams = new MarginLayoutParams(
						MarginLayoutParams.MATCH_PARENT,
						MarginLayoutParams.WRAP_CONTENT);

				rootLayoutPrams.setMargins(0, Utils.dip2px(getActivity(), 3),
						0, Utils.dip2px(getActivity(), 3));

				// ºÊ»›µÕ∞Ê±æ…Ë÷√margin∑Ω∑®
				LayoutParams layoutPrarams = new LayoutParams(rootLayoutPrams);
				layoutPrarams.gravity = Gravity.TOP | Gravity.LEFT;

				rootLayout.setLayoutParams(layoutPrarams);
				rootLayout.setClickable(true);
				rootLayout.setGravity(Gravity.CENTER_VERTICAL);
				rootLayout.setPadding(Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 5),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 5));
				rootLayout
						.setBackgroundResource(R.drawable.jiandujiancha_item_style);

				/*********************************************/
				TextView tvItemTitle = new TextView(getActivity());

				RelativeLayout.LayoutParams rlItemLayout = new RelativeLayout.LayoutParams(
						RelativeLayout.LayoutParams.WRAP_CONTENT,
						RelativeLayout.LayoutParams.WRAP_CONTENT);
				rlItemLayout.addRule(RelativeLayout.CENTER_VERTICAL);
				tvItemTitle.setLayoutParams(rlItemLayout);

				tvItemTitle.setPadding(Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8));
				tvItemTitle.setTextColor(Color.parseColor("#656769"));
				tvItemTitle.setTextSize(20);
				tvItemTitle.setText(temp.getName());

				rootLayout.addView(tvItemTitle);

				/*********************************************/

				CheckBox cbCheckBox = new CheckBox(getActivity());

				/**
				 * «Â¿Ì∂‡—°
				 */
				cbCheckBox
						.setOnCheckedChangeListener(new OnCheckedChangeListener() {

							@Override
							public void onCheckedChanged(
									CompoundButton buttonView, boolean isChecked) {

								/**
								 * µ•—°,«Â¿Ìcheckbox
								 */
								for (CheckBox checkBox : cbsCheckBoxs) {
									checkBox.setChecked(false);
								}

								buttonView.setChecked(isChecked);

							}
						});

				cbCheckBox.setTag(temp);

				RelativeLayout.LayoutParams cbBeiJianChaHangYeLayout = new RelativeLayout.LayoutParams(
						RelativeLayout.LayoutParams.WRAP_CONTENT,
						RelativeLayout.LayoutParams.WRAP_CONTENT);
				cbBeiJianChaHangYeLayout
						.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
				cbBeiJianChaHangYeLayout
						.addRule(RelativeLayout.CENTER_VERTICAL);
				cbCheckBox.setLayoutParams(cbBeiJianChaHangYeLayout);

				if (temp.equals(dataBean.data.getJianCeLeiBie())) {
					cbCheckBox.setChecked(true);
				} else {
					cbCheckBox.setChecked(false);
				}

				cbCheckBox.setButtonDrawable(R.drawable.checkbox_select_style);

				rootLayout.addView(cbCheckBox);

				rootLayout.setTag(cbCheckBox);

				// ‘ˆº”µΩª∫¥ÊºØ∫œ÷–
				cbsCheckBoxs.add(cbCheckBox);

				layout.addView(rootLayout);

				// ∞Û∂® ¬º˛,µ±≤ºæ÷±ªµ„ª˜µƒ ±∫Ú—°÷–checkbox
				rootLayout.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {

						if (rootLayout.getTag() instanceof CheckBox) {

							CheckBox cbsJianChaNeiRong = (CheckBox) rootLayout
									.getTag();

							// Ω´÷∏∂®œÓ—°÷–
							if (cbsJianChaNeiRong.isChecked()) {
								cbsJianChaNeiRong.setChecked(false);
							} else {
								cbsJianChaNeiRong.setChecked(true);
							}

						}

					}
				});

			}

			// µ◊≤øWindow µƒ∑µªÿ∞¥≈•
			ViewGroup btnBottomBack = (ViewGroup) bottomLayout
					.findViewById(R.id.btnBack);

			btnBottomBack.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					bottomWindow.dismiss();
				}
			});

			// —°‘Ò«¯”Úµ◊≤øµƒ»∑∂®∞¥≈•
			ViewGroup btnSure = (ViewGroup) bottomLayout
					.findViewById(R.id.btnSureJianChaNeiRong);

			btnSure.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					dataBean.data.setJianCeLeiBie(null);

					for (CheckBox checkBox : cbsCheckBoxs) {

						if (checkBox.getTag() instanceof JianCeLeiBie
								&& checkBox.isChecked()) {

							JianCeLeiBie data = (JianCeLeiBie) checkBox
									.getTag();

							dataBean.data.setJianCeLeiBie(data);

							break;
						}

					}

					sureExecuter.sureJianCeLeiBie();
					// clearBeijingdanwei();
					SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

					bottomWindow.dismiss();

				}
			});

		}

		/**
		 * µ±µ„ª˜≤˙∆∑¿‡±µƒ ±∫Ú
		 */
		if (v == rl_chanpinjiance_item_chanpinleibie) {

			bottomWindow.show();

			/**
			 * ºÏ≤È––“µµ◊≤øµƒ≤ºæ÷
			 */
			ViewGroup bottomLayout = (ViewGroup) getActivity()
					.getLayoutInflater().inflate(
							R.layout.bottom_jianchaneirong, null);

			// »√µ◊≤øµƒøÌ∂»∫Õ∆¡ƒªµƒøÌ∂»“ª÷¬
			bottomLayout.setMinimumWidth(getActivity().getWindowManager()
					.getDefaultDisplay().getWidth());

			// …Ë÷√µ◊≤ø≤ºæ÷
			bottomWindow.setContentView(bottomLayout);

			// µØ≥ˆ ‰»Î∑®µƒ≤Ÿ◊˜
			bottomWindow.getWindow().clearFlags(
					WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

			bottomWindow.getWindow().setGravity(Gravity.BOTTOM);

			// …Ë÷√±ÍÃ‚

			TextView tvTitle = (TextView) bottomLayout
					.findViewById(R.id.bottomTitle);

			tvTitle.setText(getString(R.string.chanpinjiance_chanpinleibie_title));

			/**
			 * Ω¯–– ”Õºµƒ∂ØÃ¨…˙≥…
			 */
			ViewGroup layout = (ViewGroup) bottomLayout
					.findViewById(R.id.jianchaneironglayout);
			// «Â¿Ì ”Õº
			layout.removeAllViews();

			// ≤È—Ø≥ˆÀ˘”–ºÏ≤È––“µ
			String[] ps=null;
			if(dataBean.checkPlan())
				ps=dataBean.getPlan().arrayEntProduces();

			List<ChanPinLeiBie> chanPinLeiBies =new ArrayList<ChanPinLeiBie>();

			List<ChanPinLeiBie> jianYanLeiBies1 = db.queryAllChanPinLeiBie();
			if(ps!=null){
				for(int i=0;i<jianYanLeiBies1.size();i++){
					if(Arrays.binarySearch(ps, jianYanLeiBies1.get(i).getId().toString())>=0){
						chanPinLeiBies.add(jianYanLeiBies1.get(i));
					}
				}

			}else{
				chanPinLeiBies=jianYanLeiBies1;

			}


			final List<CheckBox> cbsCheckBoxs = new ArrayList<CheckBox>();

			// ±È¿˙ºÏ≤È––“µΩ¯–– ”Õºµƒ…˙≥…
			for (final ChanPinLeiBie temp : chanPinLeiBies) {

				final RelativeLayout rootLayout = new RelativeLayout(
						getActivity());

				MarginLayoutParams rootLayoutPrams = new MarginLayoutParams(
						MarginLayoutParams.MATCH_PARENT,
						MarginLayoutParams.WRAP_CONTENT);

				rootLayoutPrams.setMargins(0, Utils.dip2px(getActivity(), 3),
						0, Utils.dip2px(getActivity(), 3));

				// ºÊ»›µÕ∞Ê±æ…Ë÷√margin∑Ω∑®
				LayoutParams layoutPrarams = new LayoutParams(rootLayoutPrams);
				layoutPrarams.gravity = Gravity.TOP | Gravity.LEFT;

				rootLayout.setLayoutParams(layoutPrarams);
				rootLayout.setClickable(true);
				rootLayout.setGravity(Gravity.CENTER_VERTICAL);
				rootLayout.setPadding(Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 5),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 5));
				rootLayout
						.setBackgroundResource(R.drawable.jiandujiancha_item_style);

				/*********************************************/
				TextView tvItemTitle = new TextView(getActivity());

				RelativeLayout.LayoutParams rlItemLayout = new RelativeLayout.LayoutParams(
						RelativeLayout.LayoutParams.WRAP_CONTENT,
						RelativeLayout.LayoutParams.WRAP_CONTENT);
				rlItemLayout.addRule(RelativeLayout.CENTER_VERTICAL);
				tvItemTitle.setLayoutParams(rlItemLayout);

				tvItemTitle.setPadding(Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8),
						Utils.dip2px(getActivity(), 8));
				tvItemTitle.setTextColor(Color.parseColor("#656769"));
				tvItemTitle.setTextSize(20);
				tvItemTitle.setText(temp.getName());

				rootLayout.addView(tvItemTitle);

				/*********************************************/

				CheckBox cbCheckBox = new CheckBox(getActivity());

				/**
				 * «Â¿Ì∂‡—°
				 */
				cbCheckBox
						.setOnCheckedChangeListener(new OnCheckedChangeListener() {

							@Override
							public void onCheckedChanged(
									CompoundButton buttonView, boolean isChecked) {

								/**
								 * µ•—°,«Â¿Ìcheckbox
								 */
								for (CheckBox checkBox : cbsCheckBoxs) {
									checkBox.setChecked(false);
								}

								buttonView.setChecked(isChecked);

							}
						});

				cbCheckBox.setTag(temp);

				RelativeLayout.LayoutParams cbBeiJianChaHangYeLayout = new RelativeLayout.LayoutParams(
						RelativeLayout.LayoutParams.WRAP_CONTENT,
						RelativeLayout.LayoutParams.WRAP_CONTENT);
				cbBeiJianChaHangYeLayout
						.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
				cbBeiJianChaHangYeLayout
						.addRule(RelativeLayout.CENTER_VERTICAL);
				cbCheckBox.setLayoutParams(cbBeiJianChaHangYeLayout);

				if (temp.equals(dataBean.data.getChanPinLeiBie())) {
					cbCheckBox.setChecked(true);
				} else {
					cbCheckBox.setChecked(false);
				}

				cbCheckBox.setButtonDrawable(R.drawable.checkbox_select_style);

				rootLayout.addView(cbCheckBox);

				rootLayout.setTag(cbCheckBox);

				// ‘ˆº”µΩª∫¥ÊºØ∫œ÷–
				cbsCheckBoxs.add(cbCheckBox);

				layout.addView(rootLayout);

				// ∞Û∂® ¬º˛,µ±≤ºæ÷±ªµ„ª˜µƒ ±∫Ú—°÷–checkbox
				rootLayout.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {

						if (rootLayout.getTag() instanceof CheckBox) {

							CheckBox cbsJianChaNeiRong = (CheckBox) rootLayout
									.getTag();

							// Ω´÷∏∂®œÓ—°÷–
							if (cbsJianChaNeiRong.isChecked()) {
								cbsJianChaNeiRong.setChecked(false);
							} else {
								cbsJianChaNeiRong.setChecked(true);
							}

						}

					}
				});

			}

			// µ◊≤øWindow µƒ∑µªÿ∞¥≈•
			ViewGroup btnBottomBack = (ViewGroup) bottomLayout
					.findViewById(R.id.btnBack);

			btnBottomBack.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					bottomWindow.dismiss();
				}
			});

			// —°‘Ò«¯”Úµ◊≤øµƒ»∑∂®∞¥≈•
			ViewGroup btnSure = (ViewGroup) bottomLayout
					.findViewById(R.id.btnSureJianChaNeiRong);

			btnSure.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					// »Áπ˚“—æ≠—°‘Ò¡À—˘∆∑–≈œ¢‘ÚÃ· æ
					if (dataBean.checkYangPinXinXi()) {

						final CustomDialog customDialog = new CustomDialog(
								getActivity());

						customDialog
								.setOnCancleClickListener(new OnClickListener() {

									@Override
									public void onClick(View v) {
										customDialog.dismiss();

										bottomWindow.dismiss();

									}
								});

						customDialog
								.setOnActionClickListener(new OnClickListener() {

									@Override
									public void onClick(View v) {
										customDialog.dismiss();

										dataBean.data.setChanPinLeiBie(null);

										dataBean.data.setJianCeFangFa(null);

										dataBean.data.setJianCeYiJu(null);

										for (CheckBox checkBox : cbsCheckBoxs) {

											if (checkBox.getTag() instanceof ChanPinLeiBie
													&& checkBox.isChecked()) {

												ChanPinLeiBie data = (ChanPinLeiBie) checkBox
														.getTag();

												dataBean.data
														.setChanPinLeiBie(data);

												break;
											}

										}

										sureExecuter.sureChanPinLeiBie();

										SerliazableUtil.saveTemp(dataBean.data,
												user.getUsername());

										bottomWindow.dismiss();

										dataBean.data.getYangPins().clear();
										sureExecuter.sureYangPinXinXi();

									}
								});

						customDialog
								.setMessage("已经填写了样品信息,重新选择产品类别将会清空样品信息,是否更改?");
												customDialog.setCancleTxt("取消");
												customDialog.setActionTxt("更改");
						customDialog.show();

						return;

					}

					dataBean.data.setChanPinLeiBie(null);

					dataBean.data.setJianCeFangFa(null);

					dataBean.data.setJianCeYiJu(null);

					for (CheckBox checkBox : cbsCheckBoxs) {

						if (checkBox.getTag() instanceof ChanPinLeiBie
								&& checkBox.isChecked()) {

							ChanPinLeiBie data = (ChanPinLeiBie) checkBox
									.getTag();

							dataBean.data.setChanPinLeiBie(data);

							break;
						}

					}

					sureExecuter.sureChanPinLeiBie();

					SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

					bottomWindow.dismiss();

				}
			});

		}





		/**
		 * ≥È—˘≈ƒ’’
		 */
		if (v == rl_chanpinjiance_item_chouyangpaizhao) {
			if(InitApplication.organization!=null){
				Intent to_paizhao_intent = new Intent(getActivity(),
						PaiZhaoActivity.class);

				to_paizhao_intent.putExtra("photos",
						(Serializable) dataBean.data.getPhotos());
				to_paizhao_intent.putExtra("title", "抽样拍照");

				startActivityForResult(to_paizhao_intent, TO_CHOUYANGPAIZHAO);
			}
			else{
				DialogUtil.showMessageDialog("请填写受检单位..", null, getActivity());
			}
		}

		/**
		 * µ„ª˜—˘∆∑–≈œ¢µƒ ±∫Ú
		 */
		if (v == rl_chanpinjiance_item_yangpinxinxi) {

			//  «∑Ò—°‘Ò≤˙∆∑¿‡±
			//if (dataBean.checkChanPinLeiBie()) {

			Intent to_ypxx_intent = new Intent(getActivity(),
					YangPinXinXiActivity.class);

			to_ypxx_intent
					.putExtra("yangpins", dataBean.data.getYangPins());
			to_ypxx_intent.putExtra("user", user);
			if(dataBean.checkPlan()){
				to_ypxx_intent.putExtra("planId", dataBean.getPlan().getId());
			}else
				to_ypxx_intent.putExtra("planId", "0");
			to_ypxx_intent.putExtra("chanpinleibie",
					dataBean.data.getChanPinLeiBie());

			startActivityForResult(to_ypxx_intent,
					TO_YANGPINXINXI_REQUEST_CODE);

			//			} else {
			//				Toast.makeText(getActivity(), "«Îœ»—°‘Ò≤˙∆∑¿‡±..", Toast.LENGTH_LONG)
			//						.show();
			//			}

		}

		/**
		 * µ„ª˜«©√˚µƒ ±∫Ú
		 */
		if (v == rl_chanpinjiance_item_qianming) {

			if (!ImageUtil.hasStore()) {
				Toast.makeText(getActivity(), "未检测到存储卡", Toast.LENGTH_LONG)
						.show();
			} else {
				Intent to_qianming = new Intent(getActivity(),
						QianMingActivity.class);
				to_qianming.putExtra("qianmingpath",
						dataBean.data.getQianMingPath());

				startActivityForResult(to_qianming, TO_QIANMING);
			}

		}

	}

	/**
	 * »∑»œ∂‘œÛ
	 *
	 * @author Mr
	 *
	 */
	private class SureExecuter {
		/**∂‘œÛ¿‡–Õ*/
		protected void sureDuxiangleixing(){

			onSureDuxiangleixing();

		}
		/**º∆ªÆ*/
		protected void surePlan(){


			if(dataBean.checkPlan()){
				rl_chanpinjiance_item_renwulaiyuan.setVisibility(View.GONE);
				rl_chanpinjiance_item_jianyanleibie.setVisibility(View.GONE);

			}else{
				rl_chanpinjiance_item_renwulaiyuan.setVisibility(View.VISIBLE);
				rl_chanpinjiance_item_jianyanleibie.setVisibility(View.VISIBLE);
			}

		}
		/**
		 * »∑∂®ºÏ≤È––“µ
		 */
		private void sureJianChaHangYe() {

			TextView tvContentDescript = (TextView) rl_jiandujiancha_item_jianchahangye
					.findViewById(R.id.tvContentDescript5);

			if (dataBean.checkJianChaHangYe()) {
				toggleIconChange(rl_jiandujiancha_item_jianchahangye, true);
				tvContentDescript.setText(dataBean.getJianChaHangYeString());

			} else {
				toggleIconChange(rl_jiandujiancha_item_jianchahangye, false);
				tvContentDescript.setText("");

			}

		}

		/**
		 * »∑∂®«¯”Ú,Ω´«¯”Ú–≈œ¢ È–¥µΩ√Ê∞Â
		 */
		private void sureQuYu() {

			TextView tvContentDescript = (TextView) rl_chanpinjiance_item_suoshuquyu
					.findViewById(R.id.tvContentDescript4);

			if (dataBean.checkQuYu()) {
				toggleIconChange(rl_chanpinjiance_item_suoshuquyu, true);
				if(dataBean.checkPlan()){
					tvContentDescript.setText(dataBean.getPlan().getEntAreaName());
				}else
					tvContentDescript.setText(dataBean.getQuYuString());

			} else {

				toggleIconChange(rl_chanpinjiance_item_suoshuquyu, false);

				tvContentDescript.setText("");

			}
		}

		/**
		 * »∑∂®≥È—Èª˙ππ
		 */
		private void sureChouYangJieGuo() {

			TextView tvContentDescript = (TextView) rl_chanpinjiance_item_chouyangjigou
					.findViewById(R.id.tvContentDescript1);

			if (dataBean.checkChouYanJiGou()) {

				toggleIconChange(rl_chanpinjiance_item_chouyangjigou, true);

				tvContentDescript.setText(dataBean.getChouYangJiGouString());
			} else {
				toggleIconChange(rl_chanpinjiance_item_chouyangjigou, false);
				tvContentDescript.setText("");
			}

		}

		private void sureChouYangRenYuan() {

			TextView tvContentDescript = (TextView) rl_chanpinjiance_item_chouyangrenyuan
					.findViewById(R.id.tvContentDescript2);

			if (dataBean.checkChouYangRenYuanOne()) {
				toggleIconChange(rl_chanpinjiance_item_chouyangrenyuan, false);

				tvContentDescript.setText(dataBean.getChouYangRenYuanString());

			} else if (dataBean.checkChouYangRenYuan()) {

				toggleIconChange(rl_chanpinjiance_item_chouyangrenyuan, true);

				tvContentDescript.setText(dataBean.getChouYangRenYuanString());
			} else {
				toggleIconChange(rl_chanpinjiance_item_chouyangrenyuan, false);
				tvContentDescript.setText("");

			}

		}

		private void sureShouJianDanWei() {

			TextView tvContentDescript = (TextView) rl_chanpinjiance_item_shoujiandanwei
					.findViewById(R.id.tvContentDescript7);

			llCreateShouJianDanWeiLayout.setVisibility(View.GONE);

			if (dataBean.checkShouJianDanWei()) {

				toggleIconChange(rl_chanpinjiance_item_shoujiandanwei, true);
				ChanPinJianCeActivity.bjdw=dataBean.data.getShouJianDanWei();
				tvContentDescript.setText(dataBean.data.getShouJianDanWei()
						.getName());
				int shouJianDanWeiCount=3;
				//				int shouJianDanWeiCount = db
				//						.queryCountBeiJianDanWeiByName(dataBean.data
				//								.getShouJianDanWei().getName(),dataBean.data
				//								.getShouJianDanWei().getCode());
				InitApplication.photolat=dataBean.data.getShouJianDanWei().getLatitude();
				InitApplication.photolng=dataBean.data.getShouJianDanWei().getLongitude();
				InitApplication.organization=dataBean.data.getShouJianDanWei().getName();
				if (shouJianDanWeiCount < 1) {
					// “˛≤ÿÃÓ–¥≥È—˘µ•Œªµƒ–≈œ¢≤ºæ÷
					rlChouYangDanWeiLianXiFangShi.setVisibility(View.VISIBLE);

					rlChouYangDanWeiFuZeRen.setVisibility(View.VISIBLE);

					rlChouYangDanWeiAdress.setVisibility(View.VISIBLE);


					llCreateShouJianDanWeiLayout.setVisibility(View.VISIBLE);
				} else {
					llCreateShouJianDanWeiLayout.setVisibility(View.GONE);
					rlChouYangDanWeiLianXiFangShi.setVisibility(View.GONE);

					rlChouYangDanWeiFuZeRen.setVisibility(View.GONE);

					rlChouYangDanWeiAdress.setVisibility(View.GONE);
				}



			} else {
				toggleIconChange(rl_chanpinjiance_item_shoujiandanwei, false);
				tvContentDescript.setText("");
			}

		}

		private void sureTongXunDiZhi() {

			TextView tvContentDescript = (TextView) rlChouYangDanWeiAdress
					.findViewById(R.id.tvContentDescript8);

			if (dataBean.checkTongXunDiZhi()) {

				toggleIconChange(rlChouYangDanWeiAdress, true);

				tvContentDescript.setText(dataBean.data.getShouJianDanWei()
						.getAddress());

			} else {
				toggleIconChange(rlChouYangDanWeiAdress, false);
				tvContentDescript.setText("");
			}

		}

		/**
		 * »∑»œ∏∫‘»À
		 */
		private void sureFuZeRen() {

			TextView tvContentDescript = (TextView) rlChouYangDanWeiFuZeRen
					.findViewById(R.id.tvContentDescript);

			if (dataBean.checkFuZeRen()) {

				toggleIconChange(rlChouYangDanWeiFuZeRen, true);

				tvContentDescript.setText(dataBean.data.getShouJianDanWei()
						.getCharge());

			} else {
				toggleIconChange(rlChouYangDanWeiFuZeRen, false);
				tvContentDescript.setText("");
			}

		}

		/**
		 * »∑»œ¡™œµ∑Ω Ω
		 */
		private void sureLianXiFangShi() {

			TextView tvContentDescript = (TextView) rlChouYangDanWeiLianXiFangShi
					.findViewById(R.id.tvContentDescript18);

			if (dataBean.checkLianXiFangShi()) {

				toggleIconChange(rlChouYangDanWeiLianXiFangShi, true);

				tvContentDescript.setText(dataBean.data.getShouJianDanWei()
						.getMobile());

			} else {
				toggleIconChange(rlChouYangDanWeiLianXiFangShi, false);
				tvContentDescript.setText("");
			}

		}

		/**
		 * »∑»œ—˘∆∑–≈œ¢
		 */
		private void sureYangPinXinXi() {

			TextView tvContentDescript = (TextView) rl_chanpinjiance_item_yangpinxinxi
					.findViewById(R.id.tvContentDescript14);

			if (dataBean.checkYangPinXinXi()) {

				toggleIconChange(rl_chanpinjiance_item_yangpinxinxi, true);

				tvContentDescript.setText(dataBean.getYangPinXinXiString());

			} else {
				toggleIconChange(rl_chanpinjiance_item_yangpinxinxi, false);
				tvContentDescript.setText("");
			}

		}

		/**
		 * »∑»œ»ŒŒÒ¿¥‘¥
		 */
		private void sureRenWuLaiYuan() {

			TextView tvContentDescript = (TextView) rl_chanpinjiance_item_renwulaiyuan
					.findViewById(R.id.tvContentDescript9);

			if (dataBean.checkRenWuLaiYuan()) {

				toggleIconChange(rl_chanpinjiance_item_renwulaiyuan, true);

				tvContentDescript.setText(dataBean.getRenWuLaiYuanStr());

			} else {
				toggleIconChange(rl_chanpinjiance_item_renwulaiyuan, false);
				tvContentDescript.setText("");
			}

		}
		/**
		 * »∑»œºÏ≤‚ª∑Ω⁄
		 */
		private void sureHuanjie() {




			TextView tvContentDescript = (TextView) rl_jianchehuanjie
					.findViewById(R.id.tvContentDescript3);

			if (dataBean.data!=null&&dataBean.data.getHuanjie()!=null) {

				toggleIconChange(rl_jianchehuanjie, true);

				tvContentDescript.setText(dataBean.data.getHuanjie().getName());

			} else {
				toggleIconChange(rl_jianchehuanjie, false);
				tvContentDescript.setText("");
			}

		}
		/**
		 * »∑»œºÏ≤‚¿‡±
		 */
		private void sureJianCeLeiBie() {

			TextView tvContentDescript = (TextView) rl_chanpinjiance_item_jianyanleibie
					.findViewById(R.id.tvContentDescript10);

			if (dataBean.checkJianCeLeiBie()) {

				toggleIconChange(rl_chanpinjiance_item_jianyanleibie, true);

				tvContentDescript.setText(dataBean.getJianCeLeiBieStr());

			} else {
				toggleIconChange(rl_chanpinjiance_item_jianyanleibie, false);
				tvContentDescript.setText("");
			}

		}

		/**
		 * »∑»œ≤˙∆∑¿‡±
		 */
		private void sureChanPinLeiBie() {

			TextView tvContentDescript = (TextView) rl_chanpinjiance_item_chanpinleibie
					.findViewById(R.id.tvContentDescript11);

			if (dataBean.checkChanPinLeiBie()) {

				toggleIconChange(rl_chanpinjiance_item_chanpinleibie, true);

				tvContentDescript.setText(dataBean.getChanPinLeiBieStr());

				List<JianCeFangFa> jianCeFangFas = db
						.queryAllJianCeFangFa(dataBean.data.getChanPinLeiBie()
								.getId());

				if (jianCeFangFas != null && jianCeFangFas.size() == 1) {
					dataBean.data.setJianCeFangFa(jianCeFangFas.get(0));
				}

			} else {
				toggleIconChange(rl_chanpinjiance_item_chanpinleibie, false);
				tvContentDescript.setText("");

			}


		}




		/**
		 * ¥_∂®≈ƒ’’
		 */
		private void surePaiZhao() {

			ViewGroup photoLayout = (ViewGroup) rl_chanpinjiance_item_chouyangpaizhao
					.findViewById(R.id.llContentDescript);

			photoLayout.setVisibility(View.INVISIBLE);

			if (dataBean.checkPaiZhao()) {

				toggleIconChange(rl_chanpinjiance_item_chouyangpaizhao, true);

				photoLayout.removeAllViews();

				photoLayout.setVisibility(View.VISIBLE);

				List<Photo> photos = dataBean.data.getUploadPhoto();

//				List<Photo> photos = dataBean.data.getPhotos();
				for (int i = 0; i < photos.size(); i++) {

					Photo photo = photos.get(i);

					// ◊Ó∂‡∑≈5∏ˆÕº∆¨
					if (i > 5) {
						break;
					}

					ImageView imageView = new ImageView(getActivity());

					imageView.setClickable(false);

					if (i == 0) {

						int widthOrHeight = Utils.dip2px(getActivity(), 50);

						int marginLeft = Utils.dip2px(getActivity(), 8);

						MarginLayoutParams rootLayoutPrams = new MarginLayoutParams(
								widthOrHeight, widthOrHeight);

						rootLayoutPrams.setMargins(marginLeft, 0, 0, 0);

						// ºÊ»›µÕ∞Ê±æ…Ë÷√margin∑Ω∑®
						LayoutParams layoutPrarams = new LayoutParams(
								rootLayoutPrams);
						layoutPrarams.gravity = Gravity.TOP | Gravity.LEFT;

						imageView.setLayoutParams(layoutPrarams);
						imageView.setScaleType(ScaleType.CENTER_CROP);
					} else {

						int widthOrHeight = Utils.dip2px(getActivity(), 50);

						int marginLeft = Utils.dip2px(getActivity(), 15);

						MarginLayoutParams rootLayoutPrams = new MarginLayoutParams(
								widthOrHeight, widthOrHeight);

						rootLayoutPrams.setMargins(marginLeft, 0, 0, 0);

						// ºÊ»›µÕ∞Ê±æ…Ë÷√margin∑Ω∑®
						LayoutParams layoutPrarams = new LayoutParams(
								rootLayoutPrams);
						layoutPrarams.gravity = Gravity.TOP | Gravity.LEFT;

						imageView.setLayoutParams(layoutPrarams);

						imageView.setScaleType(ScaleType.CENTER_CROP);

					}

					BitmapFactory.Options opts = new BitmapFactory.Options();
					opts.inSampleSize = 2;

					Bitmap image = BitmapFactory.decodeFile(
							(String) photo.getSmallPhotoPath(), opts);

					if (photo.getSmallPhotoPath() instanceof String) {
						imageView.setImageBitmap(image);

					}

					photoLayout.addView(imageView);

				}

			} else {
				toggleIconChange(rl_chanpinjiance_item_chouyangpaizhao, false);
			}

		}

		/**
		 * »∑∂®«©√˚
		 */
		private void sureQianMing() {

			ImageView ivSmallImage = (ImageView) rl_chanpinjiance_item_qianming
					.findViewById(R.id.qianMingSmallImage);

			if (dataBean.checkQianMing()) {

				BitmapFactory.Options options = new BitmapFactory.Options();

				options.inSampleSize = 2;

				Bitmap smallImage = BitmapFactory.decodeFile(
						dataBean.data.getQianMingPath(), options);

				if (smallImage != null) {
					ivSmallImage.setImageBitmap(smallImage);
					toggleIconChange(rl_chanpinjiance_item_qianming, true);
				}

			} else {
				// «Âø’Õº∆¨.
				ivSmallImage.setImageBitmap(null);
				toggleIconChange(rl_chanpinjiance_item_qianming, false);

			}

		}

		/**
		 * ∏ƒ±‰—°‘ÒµƒÕº±Í
		 */
		public void toggleIconChange(ViewGroup viewGroup, boolean selected) {

			View ivChangeIcon = viewGroup.findViewWithTag("ivChangeIcon");

			Animation imageFadeIn = AnimationUtils.loadAnimation(getActivity(),
					R.anim.icon_anim_move_x);

			if (ivChangeIcon != null && ivChangeIcon instanceof ImageView) {

				ImageView imageView = (ImageView) ivChangeIcon;

				/**
				 * »Áπ˚ «∏¸∂‡‘Ú«–ªªŒ™
				 */
				if (selected) {
					imageView.setImageResource(R.drawable.item_select);
				} else {
					imageView
							.setImageResource(R.drawable.jiandujiancha_icon_more);
				}
				// º”‘ÿΩ¯»Î

				imageView.clearAnimation();

				imageView.setAnimation(imageFadeIn);

				imageFadeIn.start();
			}
		}

	}

	/**
	 *  ˝æ›∂‘œÛ
	 */
	public class DataBean {
		/**
		 * À˘”–µƒ’’∆¨–≈œ¢
		 *
		 */
		private ArrayList<Photo> photos = new ArrayList<Photo>();

		public String getDuixiangleixingStr() {

			StringBuffer jianChaNeiRongStr = new StringBuffer();

			for (int i = 0; i < data.getDuixiangleixing().size(); i++) {

				Duixiangleixing jianChaNeiRong = data.getDuixiangleixing()
						.get(i);

				jianChaNeiRongStr.append(jianChaNeiRong.getName());

				jianChaNeiRongStr.append(". ");



			}
			return jianChaNeiRongStr.toString();

		}
		//ºÏ≤È∂‘œÛ¿‡–Õ
		public boolean checkDuixiangleixing() {
			if(data==null||data.getDuixiangleixing()==null)return false;
			if (data.getDuixiangleixing().size() > 0) {
				return true;
			} else {
				return false;
			}
		}
		//ºÏ≤È∂‘œÛ¿‡–Õ
		public boolean checkPlan() {
			if(data==null||data.getPlan()==null)return false;
			return true;
		}
		//º∆ªÆ»ŒŒÒ
		public Plan getPlan(){
			return data.getPlan();
		}
		/**
		 * ºÏ≤È±ªºÏµ•Œª «∑ÒÃÓ–¥
		 *
		 * @return
		 */
		public boolean checkJianChaHangYe() {
			if (data.getJianChaHangYes().size() > 0) {
				return true;
			} else {
				return false;
			}
		}

		public String getJianChaHangYeString() {

			StringBuffer jianChaHangYeStr = new StringBuffer();

			for (int i = 0; i < data.getJianChaHangYes().size(); i++) {

				JianChaHangYe jianChaHangYe = data.getJianChaHangYes().get(i);

				jianChaHangYeStr.append(jianChaHangYe.getName());

				jianChaHangYeStr.append(". ");

				if (i < data.getJianChaHangYes().size() - 1) {
					jianChaHangYeStr.append("\n");
				}

			}

			return jianChaHangYeStr.toString();

		}
		private ChanPinJianCeRecord data = null;

		public ChanPinJianCeRecord getData() {
			return data;
		}
		public Town getTown() {

			for (Town town : data.getTowns()) {

				if (town != null&&town.getCode().length()>6) {
					return town;
				}

			}

			return new Town("3204","常州");

		}
		public boolean checkQuYu() {
			if(dataBean.checkPlan()){return true;}
			boolean result = false;

			for (Town town : data.getTowns()) {

				if (town != null&&town.getCode().length()>6) {
					result = true;

					break;
				}

			}

			return result;

		}

		public String getQuYuString() {

			StringBuffer result = new StringBuffer();

			for (int i = 0; i < data.getTowns().length; i++) {

				Town town = data.getTowns()[i];

				if (town != null) {

					if (!CharsetUtil.isNotNull(town.getName())) {

						town = db.queryTownById(town.getCode());
					}

					result.append(town.getName());
					result.append("--");
				}

			}

			if (result.length() > 0) {
				return result.substring(0, result.length() - 2);
			} else {

				return result.toString();
			}

		}

		public String getKnowCode() {
			if (data.getTowns()[3] != null) {

				return data.getTowns()[3].getCode();
			}else if (data.getTowns()[2] != null) {

				return data.getTowns()[2].getCode();
			} else if (data.getTowns()[1] != null) {

				return data.getTowns()[1].getCode();
			} else if (data.getTowns()[0] != null) {

				return data.getTowns()[0].getCode();
			} else {
				return null;
			}

		}

		public boolean checkChouYanJiGou() {
			if (data.getChouYanJiGou() != null) {
				return true;
			} else {
				return false;
			}

		}

		public String getChouYangJiGouString() {

			StringBuffer jianChaDanWeiTxt = new StringBuffer();

			ChouYanJiGou jianChaDanWei = data.getChouYanJiGou();

			jianChaDanWeiTxt.append(jianChaDanWei.getName());

			jianChaDanWeiTxt.append(". ");

			return jianChaDanWeiTxt.toString();

		}

		public boolean checkChouYangRenYuan() {
			if (data.getChouYangRenYuans().size() > 0) {
				return checkChouYangRenYuanCount();
			} else {
				return false;
			}

		}

		public boolean checkChouYangRenYuanOne() {
			if (data.getChouYangRenYuans().size() == 1) {
				return true;
			} else {
				return false;
			}

		}

		public boolean checkChouYangRenYuanCount() {
			if (data.getChouYangRenYuans().size() > 1) {
				return true;
			} else {
				return false;
			}

		}

		public String getChouYangRenYuanString() {

			StringBuffer chouYangRenYuanTxt = new StringBuffer();

			for (int i = 0; i < data.getChouYangRenYuans().size(); i++) {

				JianChaRenYuan chouYangRenYuans = data.getChouYangRenYuans()
						.get(i);

				chouYangRenYuanTxt.append(chouYangRenYuans.getName());

				chouYangRenYuanTxt.append(". ");

			}

			return chouYangRenYuanTxt.toString();

		}

		public boolean checkShouJianDanWei() {

			if (data.getShouJianDanWei() != null) {
				return true;
			} else {
				return false;
			}

		}

		public boolean checkTongXunDiZhi() {

			if (checkShouJianDanWei()
					&& CharsetUtil.isNotNull(data.getShouJianDanWei()
					.getAddress())) {
				return true;
			} else {
				return false;
			}

		}

		public boolean checkFuZeRen() {

			if (checkShouJianDanWei()
					&& CharsetUtil.isNotNull(data.getShouJianDanWei()
					.getCharge())) {
				return true;
			} else {
				return false;
			}

		}

		public boolean checkLianXiFangShi() {

			if (checkShouJianDanWei()
					&& CharsetUtil.isNotNull(data.getShouJianDanWei()
					.getMobile())) {
				return true;
			} else {
				return false;
			}

		}

		public boolean checkYangPinXinXi() {

			if (data.getYangPins().size() > 0) {

				return true;
			} else {

				return false;
			}

		}

		public String getYangPinXinXiString() {

			StringBuffer txtBuffer = new StringBuffer();

			for (int i = 0; i < data.getYangPins().size(); i++) {

				YangPin temp = data.getYangPins().get(i);

				txtBuffer.append(temp.getBianHaoString()
						+ "\u0020\u0020[\u0020" + temp.getName() + "\u0020]");

				if (i < data.getYangPins().size() - 1) {

					txtBuffer.append("\n");

				}

			}

			return txtBuffer.toString().trim();
		}

		public boolean checkRenWuLaiYuan() {

			if (data.getRenWuLaiYuan() != null) {

				return true;
			} else {

				return false;
			}

		}

		public String getRenWuLaiYuanStr() {

			StringBuffer txtBuffer = new StringBuffer();

			txtBuffer.append(data.getRenWuLaiYuan().getName());

			txtBuffer.append(". ");

			return txtBuffer.toString().trim();

		}

		public boolean checkJianCeLeiBie() {

			if (data.getJianCeLeiBie() != null) {

				return true;
			} else {

				return false;
			}

		}

		public String getJianCeLeiBieStr() {

			StringBuffer txtBuffer = new StringBuffer();

			JianCeLeiBie temp = data.getJianCeLeiBie();

			txtBuffer.append(temp.getName());

			txtBuffer.append(". ");

			return txtBuffer.toString().trim();

		}

		public boolean checkChanPinLeiBie() {

			if (data.getChanPinLeiBie() != null) {

				return true;
			} else {

				return false;
			}

		}

		public String getChanPinLeiBieStr() {

			StringBuffer txtBuffer = new StringBuffer();

			ChanPinLeiBie temp = data.getChanPinLeiBie();

			txtBuffer.append(temp.getName());

			txtBuffer.append(". ");

			return txtBuffer.toString().trim();

		}

		public boolean checkJianCeFangFa() {

			if (data.getJianCeFangFa() != null) {

				return true;
			} else {

				return false;
			}

		}

		public String getJianCeFangFaStr() {

			StringBuffer txtBuffer = new StringBuffer();

			JianCeFangFa temp = data.getJianCeFangFa();

			txtBuffer.append(temp.getName());

			txtBuffer.append(". ");

			return txtBuffer.toString().trim();

		}

		public boolean checkJianCeYiJu() {

			if (data.getJianCeYiJu() != null) {

				return true;
			} else {

				return false;
			}

		}

		public String getJianCeYiJuStr() {

			StringBuffer txtBuffer = new StringBuffer();

			JianCeYiJu temp = data.getJianCeYiJu();

			txtBuffer.append(temp.getName());

			txtBuffer.append(". ");

			return txtBuffer.toString().trim();

		}

		/**
		 * ºÏ≤‚≈ƒ’’
		 */
		public boolean checkPaiZhao() {

			if (dataBean.data.getUploadPhoto().size() > 0) {
				return true;
			} else {
				return false;
			}

		}

		/**
		 * ºÏ≤‚«©√˚
		 *
		 * @return
		 */
		public boolean checkQianMing() {

			if (CharsetUtil.isNotNull(data.getQianMingPath())) {
				return true;
			} else {
				return false;
			}

		}

	}

	/**
	 * µ± ˝æ›∑µªÿµƒ ±∫Ú
	 */
	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		if(requestCode== TO_SELENTS){
			if (data!=null) {
				String type = data.getStringExtra("type");
				if(type.equals("1")){
					Bundle iBundle=  data.getBundleExtra("data");
					BeiJianDanWei bjdw=(BeiJianDanWei)iBundle.get("ent");
					dataBean.data.setShouJianDanWei(bjdw);
					Object[] towns= (Object[])iBundle.get("towns");
					if(towns!=null){
						Town[] tow=new Town[4];
						for(int i=0;i<towns.length;i++){
							tow[i]=(Town)towns[i];
						}
						dataBean.data.setTowns(tow);
					}
					String tow= iBundle.getString("town");
					Town[] tows=new Town[4];
					if(tow!=null){
						int tl=tow.length();
						if(tl>=4){
							tows[0]=new Town(tow.substring(0,4),"");
						}
						if(tl>=6){
							tows[1]=new Town(tow.substring(0,6),"");
						}
						if(tl>=8){
							tows[2]=new Town(tow.substring(0,8),"");
						}
						if(tl>=10){
							tows[3]=new Town(tow.substring(0,10),"");
						}
						if(tl>=12){
							tows[4]=new Town(tow.substring(0,12),"");
						}
					}
					mHandler.sendEmptyMessage(20);
				}
			}
		}
		if (requestCode == TO_LISTVIEWCHECKMANAGER_REQUEST_CODE) {

			if (data != null) {

				String type = data.getStringExtra("type");

				if ("renyuan".equals(type)) {

					List<JianChaRenYuan> datas = (List<JianChaRenYuan>) data
							.getSerializableExtra("data");

					dataBean.data.getChouYangRenYuans().clear();

					for (JianChaRenYuan renYuan : datas) {
						dataBean.data.getChouYangRenYuans().add(renYuan);
					}

					sureExecuter.sureChouYangRenYuan();

					SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

				}

			}

		}

		// —˘∆∑–≈œ¢∑µªÿµƒ
		if (requestCode == TO_YANGPINXINXI_REQUEST_CODE) {

			if (data != null) {

				List<YangPin> yangPins = (List<YangPin>) data
						.getSerializableExtra("yangpins");

				this.dataBean.data.setYangPins((ArrayList<YangPin>) yangPins);

				sureExecuter.sureYangPinXinXi();

				SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

			}

		}

		/**
		 * »Áπ˚ «≈ƒ’’∑µªÿµƒ
		 */
		if (requestCode == TO_CHOUYANGPAIZHAO) {

			if (data != null) {

				ArrayList<Photo> photos = (ArrayList<Photo>) data.getExtras()
						.getSerializable("photos");

				if (photos != null) {
					dataBean.data.setPhotos(photos);
				}
			}

			sureExecuter.surePaiZhao();

			SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

		}

		/**
		 * »Áπ˚ ««©√˚∑µªÿµƒ
		 */
		if (requestCode == TO_QIANMING) {

			String qianmingpath = null;

			if (data != null) {

				qianmingpath = data.getStringExtra("qianmingpath");

			}

			dataBean.data.setQianMingPath(qianmingpath);

			sureExecuter.sureQianMing();

			SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

		}

		super.onActivityResult(requestCode, resultCode, data);
	}

	/**
	 * Ã·Ωª ˝æ›
	 */
	public boolean submit() {

		//		if (!dataBean.checkQuYu()&&!dataBean.checkPlan()) {
		//
		//			DialogUtil.showMessageDialog("«Î—°‘ÒÀ˘ Ù«¯”ÚµΩ«¯’Úº∂..", null, getActivity());
		//
		//			return false;
		//		}
		//
		//		if (!dataBean.checkChouYanJiGou()) {
		//
		//			DialogUtil.showMessageDialog("«ÎÃÓ–¥≥È—Èª˙ππ..", null, getActivity());
		//
		//			return false;
		//		}
		//
		//		if (dataBean.data.getChouYangRenYuans().size() < 1) {
		//
		//			DialogUtil.showMessageDialog("«ÎÃÓ–¥≥È—˘»À‘±..", null, getActivity());
		//
		//			return false;
		//		}
		//
		//		if (dataBean.checkChouYangRenYuanOne()) {
		//
		//			DialogUtil.showMessageDialog("«Î≤π»´≥È—˘»À‘±–≈œ¢,÷¡…ŸŒ™2»À..", null,
		//					getActivity());
		//
		//			return false;
		//
		//		}
		//
		//		if (!dataBean.checkShouJianDanWei()) {
		//
		//			DialogUtil.showMessageDialog("«ÎÃÓ–¥ ‹ºÏµ•Œª..", null, getActivity());
		//
		//			return false;
		//		}

		int shouJianDanWeiCount =1;// db
		//				.queryCountBeiJianDanWeiByName(dataBean.data
		//						.getShouJianDanWei().getName(),dataBean.data
		//						.getShouJianDanWei().getCode());

		if (shouJianDanWeiCount < 1) {

			if (!dataBean.checkTongXunDiZhi()) {

				DialogUtil.showMessageDialog("请填写通讯地址..", null, getActivity());

				return false;
			}
			if (!dataBean.checkFuZeRen()) {

				DialogUtil.showMessageDialog("请填写负责人..", null, getActivity());

				return false;
			}
			if (!dataBean.checkLianXiFangShi()) {

				DialogUtil.showMessageDialog("请填写联系方式..", null, getActivity());

				return false;
			}

		}


		if(!dataBean.checkPlan()){
			// »Áπ˚ «≥£÷›≤≈Œ™±ÿÃÓ
			if (configUtil.getConfig() == 2) {
				if (!dataBean.checkRenWuLaiYuan()) {

					DialogUtil.showMessageDialog("请填写任务来源..", null, getActivity());

					return false;
				}
			}
			// »Áπ˚ «≥£÷›≤≈Œ™±ÿÃÓ
			if (configUtil.getConfig() == 2) {

				if (!dataBean.checkJianCeLeiBie()) {

					DialogUtil.showMessageDialog("请填写检测类别..", null, getActivity());

					return false;
				}
			}
		}else{

			dataBean.data.setArea(dataBean.data.getPlan().getEntArea());


		}





		if (!dataBean.checkYangPinXinXi()) {

			DialogUtil.showMessageDialog("请填写样品信息..", null, getActivity());

			return false;
		}

		if (!dataBean.checkPaiZhao()) {

			DialogUtil.showMessageDialog("请拍照或选择上传照片..", null, getActivity());

			return false;
		}

		if (!dataBean.checkQianMing()) {

			DialogUtil.showMessageDialog("请签名..", null, getActivity());

			return false;
		}

		// »Áπ˚≤ª «±‡º≠ƒ£ Ω
		if (!isEditMode) {

			final Calendar calendar = new GregorianCalendar();

			if (CommonConstants.isNetworkConnected(getActivity())) {

				/**
				 * Õ¯¬Á ±º‰µƒ≥ı ºªØ
				 */
				new AsyncTask<Integer, Integer, Integer>() {

					private CustomDialog customDialog = null;

					// ºÏ≤‚ «∑Ò◊ﬂµƒÕ¯¬Á ±º‰
					private boolean isErr = true;

					@Override
					protected void onPreExecute() {

						if (customDialog == null) {

							customDialog = new CustomDialog(getActivity());

							customDialog.setMessage("尝试读取网络时间请等待..");

							customDialog.showWait();

						}

						super.onPreExecute();
					}

					@Override
					protected Integer doInBackground(Integer... params) {

						URL url = null;

						URLConnection uc = null;

						try {
							url = new URL("http://www.baidu.com/");// »°µ√◊ ‘¥∂‘œÛ
							uc = url.openConnection();// …˙≥…¡¨Ω”∂‘œÛ
							uc.connect(); // ∑¢≥ˆ¡¨Ω”
							long milliseconds = uc.getDate(); // »°µ√Õ¯’æ»’∆⁄ ±º‰
							calendar.setTimeInMillis(milliseconds);

							isErr = false;

						} catch (MalformedURLException e) {
						} catch (IOException e) {
						}

						return null;
					}

					protected void onPostExecute(Integer result) {

						if (customDialog != null) {
							customDialog.dismiss();

							if (isErr) {
								Toast.makeText(getActivity(),
										"读取网络时间失败..使用本地时间..",
										Toast.LENGTH_SHORT).show();
							}

						}

					};

				}.execute();

			} else {

				Toast.makeText(getActivity(), "未检测到网络..使用本地时间..",
						Toast.LENGTH_SHORT).show();

			}

			String time = new SimpleDateFormat("yyyy-MM-dd").format(calendar
					.getTime());

			dataBean.data.setTime(time);

		}

		String message = "";

		// ±‡º≠ƒ£ Ω
		if (isEditMode) {

			message = "编辑记录成功..";

			SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

			dataBean.data = null;

			isEditMode = false;

			ScrollView scrollView = (ScrollView) getActivity().findViewById(
					R.id.scrollViewNewRecord);

			scrollView.scrollTo(0, 0);

			Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();

			isEditMode = false;

		} else {
			// ‘ˆº”ƒ£ Ω
			dataBean.data.setState(1);

			SerliazableUtil.saveTemp(dataBean.data, user.getUsername());

			SerliazableUtil.deleteTempChanPinJianCe();

			message = "增加新记录成功..";
		}

		dataBean.data = null;

		ScrollView scrollView = (ScrollView) getActivity().findViewById(
				R.id.scrollViewNewRecord);

		scrollView.scrollTo(0, 0);

		onActivityCreated(null);

		Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();

		return true;

	}

	/**
	 * º”›dæé›ãƒ£ Ω
	 *
	 * @param record
	 */
	public void loadEditMode(ChanPinJianCeRecord record) {

		isEditMode = true;

		dataBean.data = record;

		ScrollView scrollView = (ScrollView) getActivity().findViewById(
				R.id.scrollViewNewRecord);

		scrollView.scrollTo(0, 0);

		onActivityCreated(null);

		Toast.makeText(getActivity(), "进入编辑模式成功..", Toast.LENGTH_SHORT).show();

	}

	public boolean isEditor() {

		return isEditMode;

	}

	/**
	 * ªÒµ√µ±«∞º«¬ºµƒID
	 */
	public String getRecordId() {

		return dataBean.getData().getId();
	}

	@Override
	public void onDestroy() {

		if (db != null)
			db.close();
		InitApplication.organization=null;
		super.onDestroy();
	}
	private int page=0;
	protected void onClickDuixiangleixing(final AlertDialog bottomWindow){

		bottomWindow.show();

		String[] kinds=null;
		if(dataBean.checkPlan())
			kinds=dataBean.getPlan().arrayEntKinds();

		/**
		 * ºÏ≤È––“µµ◊≤øµƒ≤ºæ÷
		 */
		ViewGroup bottomJianChaNeiRongWindowLayout = (ViewGroup) getActivity()
				.getLayoutInflater().inflate(
						R.layout.bottom_jianchaneirong, null);
		TextView bottomTitle=(TextView)bottomJianChaNeiRongWindowLayout.findViewById(R.id.bottomTitle);
		bottomTitle.setText("对象类型");
		// »√µ◊≤øµƒøÌ∂»∫Õ∆¡ƒªµƒøÌ∂»“ª÷¬
		bottomJianChaNeiRongWindowLayout.setMinimumWidth(getActivity()
				.getWindowManager().getDefaultDisplay().getWidth());

		// …Ë÷√µ◊≤ø≤ºæ÷
		bottomWindow.setContentView(bottomJianChaNeiRongWindowLayout);

		// µØ≥ˆ ‰»Î∑®µƒ≤Ÿ◊˜
		bottomWindow.getWindow().clearFlags(
				WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

		bottomWindow.getWindow().setGravity(Gravity.BOTTOM);

		/**
		 * Ω¯–– ”Õºµƒ∂ØÃ¨…˙≥…
		 */
		ViewGroup jianChaNeiRongLayout = (ViewGroup) bottomJianChaNeiRongWindowLayout
				.findViewById(R.id.jianchaneironglayout);
		// «Â¿Ì ”Õº
		jianChaNeiRongLayout.removeAllViews();

		// ≤È—Ø≥ˆÀ˘”–ºÏ≤È––“µ
		List<Kv> jianChaNeiRongs = kinds==null?Dict.getKinds():Dict.getKinds(kinds);

		final List<CheckBox> cbsJianChaNeiRongs = new ArrayList<CheckBox>();

		// ±È¿˙ºÏ≤È––“µΩ¯–– ”Õºµƒ…˙≥…
		for (final Kv temp1 : jianChaNeiRongs) {
			Duixiangleixing temp=new Duixiangleixing(temp1.getId(),temp1.getName());
			final RelativeLayout rootLayout = new RelativeLayout(
					getActivity());

			MarginLayoutParams rootLayoutPrams = new MarginLayoutParams(
					MarginLayoutParams.MATCH_PARENT,
					MarginLayoutParams.WRAP_CONTENT);

			rootLayoutPrams.setMargins(0,
					Utils.dip2px(getActivity(), 3), 0,
					Utils.dip2px(getActivity(), 3));

			// ºÊ»›µÕ∞Ê±æ…Ë÷√margin∑Ω∑®
			LayoutParams layoutPrarams = new LayoutParams(
					rootLayoutPrams);
			layoutPrarams.gravity = Gravity.TOP | Gravity.LEFT;

			rootLayout.setLayoutParams(layoutPrarams);
			rootLayout.setClickable(true);
			rootLayout.setGravity(Gravity.CENTER_VERTICAL);
			rootLayout.setPadding(Utils.dip2px(getActivity(), 8),
					Utils.dip2px(getActivity(), 5),
					Utils.dip2px(getActivity(), 8),
					Utils.dip2px(getActivity(), 5));
			rootLayout
					.setBackgroundResource(R.drawable.jiandujiancha_item_style);

			/*********************************************/
			TextView tvBeiJianChaHangYe = new TextView(getActivity());

			RelativeLayout.LayoutParams tvBeiJianChaHangYeLayout = new RelativeLayout.LayoutParams(
					RelativeLayout.LayoutParams.WRAP_CONTENT,
					RelativeLayout.LayoutParams.WRAP_CONTENT);
			tvBeiJianChaHangYeLayout
					.addRule(RelativeLayout.CENTER_VERTICAL);
			tvBeiJianChaHangYe
					.setLayoutParams(tvBeiJianChaHangYeLayout);

			tvBeiJianChaHangYe.setPadding(
					Utils.dip2px(getActivity(), 8),
					Utils.dip2px(getActivity(), 8),
					Utils.dip2px(getActivity(), 8),
					Utils.dip2px(getActivity(), 8));
			tvBeiJianChaHangYe
					.setTextColor(Color.parseColor("#656769"));
			tvBeiJianChaHangYe.setTextSize(20);
			tvBeiJianChaHangYe.setText(temp.getName());

			rootLayout.addView(tvBeiJianChaHangYe);

			/*********************************************/

			CheckBox cbBeiJianChaNeiRong = new CheckBox(getActivity());

			cbBeiJianChaNeiRong.setTag(temp);

			RelativeLayout.LayoutParams cbBeiJianChaHangYeLayout = new RelativeLayout.LayoutParams(
					RelativeLayout.LayoutParams.WRAP_CONTENT,
					RelativeLayout.LayoutParams.WRAP_CONTENT);
			cbBeiJianChaHangYeLayout
					.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
			cbBeiJianChaHangYeLayout
					.addRule(RelativeLayout.CENTER_VERTICAL);
			cbBeiJianChaNeiRong
					.setLayoutParams(cbBeiJianChaHangYeLayout);




			if(dataBean==null||dataBean.getData()==null){
				return;
			}
			if (dataBean.getData().getDuixiangleixing().contains(temp)) {
				cbBeiJianChaNeiRong.setChecked(true);
			} else {

				cbBeiJianChaNeiRong.setChecked(false);
			}

			cbBeiJianChaNeiRong
					.setButtonDrawable(R.drawable.checkbox_select_style);

			rootLayout.addView(cbBeiJianChaNeiRong);

			rootLayout.setTag(cbBeiJianChaNeiRong);

			// ‘ˆº”µΩª∫¥ÊºØ∫œ÷–
			cbsJianChaNeiRongs.add(cbBeiJianChaNeiRong);

			jianChaNeiRongLayout.addView(rootLayout);

			// ∞Û∂® ¬º˛,µ±≤ºæ÷±ªµ„ª˜µƒ ±∫Ú—°÷–checkbox
			rootLayout.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {

					if (rootLayout.getTag() instanceof CheckBox) {

						CheckBox cbsJianChaNeiRong = (CheckBox) rootLayout
								.getTag();

						// Ω´÷∏∂®œÓ—°÷–
						if (cbsJianChaNeiRong.isChecked()) {
							cbsJianChaNeiRong.setChecked(false);
						} else {
							cbsJianChaNeiRong.setChecked(true);
						}

					}

				}
			});

		}

		// µ◊≤øWindow µƒ∑µªÿ∞¥≈•
		ViewGroup btnBottomBack = (ViewGroup) bottomJianChaNeiRongWindowLayout
				.findViewById(R.id.btnBack);

		btnBottomBack.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				bottomWindow.dismiss();
			}
		});

		// —°‘Ò«¯”Úµ◊≤øµƒ»∑∂®∞¥≈•
		ViewGroup btnSureJianChaNeiRong = (ViewGroup) bottomJianChaNeiRongWindowLayout
				.findViewById(R.id.btnSureJianChaNeiRong);

		btnSureJianChaNeiRong.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				dataBean.getData().getDuixiangleixing().clear();

				for (CheckBox checkBox : cbsJianChaNeiRongs) {

					if (checkBox.getTag() instanceof Duixiangleixing && checkBox.isChecked()) {

						Duixiangleixing kv = (Duixiangleixing) checkBox
								.getTag();
						dataBean.getData().getDuixiangleixing().add(kv);
					}

				}

				sureExecuter.sureDuxiangleixing();

				SerliazableUtil.saveTemp(dataBean.data,
						user.getUsername());
				// clearBeijingdanwei();
				bottomWindow.dismiss();

			}
		});

	}

	public void clearBeijingdanwei(){
		dataBean.data.setShouJianDanWei(null);
		sureExecuter.sureShouJianDanWei();
	}
	protected void onSureDuxiangleixing(){
		// ≤È—Ø≥ˆº‡π‹ƒ⁄»›µƒ◊”œÓµƒΩ¯≥°ªÚ’ﬂÕÀ≥°£¨ƒ¨»œŒ™Ω¯≥°∂Øª≠


		TextView tvContentDescript = (TextView) rl_jiandujiancha_item_duixiangleixing
				.findViewById(R.id.tvContentDescript6);


		if (dataBean.checkDuixiangleixing()) {
			toggleIconChange2(rl_jiandujiancha_item_duixiangleixing, true);
			tvContentDescript.setText(dataBean.getDuixiangleixingStr());


		}else{
			toggleIconChange2(rl_jiandujiancha_item_duixiangleixing, false);
			tvContentDescript.setText("");


		}
	}

	/**
	 * ∏ƒ±‰—°‘ÒµƒÕº±Í
	 */
	public void toggleIconChange2(ViewGroup viewGroup, boolean selected) {

		View ivChangeIcon = viewGroup.findViewWithTag("ivChangeIcon");

		Animation imageFadeIn = AnimationUtils.loadAnimation(getActivity(),
				R.anim.icon_anim_move_x);

		if (ivChangeIcon != null && ivChangeIcon instanceof ImageView) {

			ImageView imageView = (ImageView) ivChangeIcon;

			/**
			 * »Áπ˚ «∏¸∂‡‘Ú«–ªªŒ™
			 */
			if (selected) {
				imageView.setImageResource(R.drawable.item_select);
			} else {
				imageView
						.setImageResource(R.drawable.jiandujiancha_icon_more);
			}
			// º”‘ÿΩ¯»Î

			imageView.clearAnimation();

			imageView.setAnimation(imageFadeIn);

			imageFadeIn.start();
		}
	}

	/**º∆ªÆ¡–±Ì**/
	protected void onClickPlan(final AlertDialog bottomWindow){


	}

	public Handler mHandler = new Handler() {
		public void handleMessage(Message msg) {
			switch(msg.what){
				case 20:
					sureExecuter.sureQuYu();
					sureExecuter.sureShouJianDanWei();
					break;

			}
		}
	};


}
